Answers for "#pragma pack(2) in c"

C
0

#pragma pack(1) in c

#include <stdio.h>

struct a {
    char one;
    char two[2];
    char eight[8];
    char four[4];
};

struct b { 
    char one;
    short two;
    long int eight;
    int four;
};

int main(int argc, char** argv) {
    struct a twoa[2] = {}; 
    struct b twob[2] = {}; 
    printf("sizeof(struct a): %i, sizeof(struct b): %i\n", sizeof(struct a), sizeof(struct b));
    printf("sizeof(twoa): %i, sizeof(twob): %i\n", sizeof(twoa), sizeof(twob));
}
Posted by: Guest on October-16-2020
0

#pragma pack(1) in c

struct Test
{
   char AA;
   int BB;
   char CC;
};
Posted by: Guest on October-16-2020

Code answers related to "C"

Browse Popular Code Answers by Language