How to use some part of array in Glimpse Structure c language

43 Views Asked by At

Basically, my question is how can I use some part of an array? For example, first byte equal to structure.code then other four byte equal structure.timestamps etc. I'm new, thanks for understands. My function:

void GlimpseStructures(char buffer[])
{
    int i = 0;
    HeartbeatPackage a;
    a.to_little_endian();

    a.code = buffer[0];
    for (i = 1; i < 5; i++) 
    {
        a.timestamp += buffer[i];
    }

    for (i = 5; i < 9; i++) 
    {
        buffer[i] += a.nanosecond_elapsed;
        printf("nanosecond:%d/n", a.nanosecond_elapsed);
    }
}
0

There are 0 best solutions below