#include <iostream>
#include <cstdint>
using namespace std;

// Define struct Frame here
struct Frame {
    uint16_t header;       // 2 bytes
    uint8_t  command;      // 1 byte
    uint8_t  length;       // 1 byte
    uint8_t  payload[6];   // 6 bytes
    uint16_t checksum;     // 2 bytes
};

// Validate size at compile time
static_assert(sizeof(Frame) == 12, "Frame size mismatch");

int main() {
    cout << "Frame OK";
    return 0;
}

Solving Approach

 

 

 

 

 

Upvote
Downvote
Loading...

Input

Expected Output

Frame OK