[ create a new paste ] login | about

Link: http://codepad.org/D1ZGfgLN    [ raw code | output | fork ]

C, pasted on Sep 10:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>

#pragma pack(push, 1)
struct employee {
	char name[31];
	int flage;
};
#pragma pack(pop)


#define PRINT_SIZEOF(v) { printf("sizeof(" # v ") = %zu\n", sizeof((v))); }

int main() {
	struct employee worker;
	PRINT_SIZEOF(worker.name);
	PRINT_SIZEOF(worker.flage);
	PRINT_SIZEOF(worker);
	return 0;
}


Output:
1
2
3
sizeof(worker.name) = 31
sizeof(worker.flage) = 4
sizeof(worker) = 35


Create a new paste based on this one


Comments: