Thread: azone2 question
View Single Post
  #5  
Old 01-29-2012, 12:19 AM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

It could be alignment or it could be that unsigned long is actually 64 bits.

The output from this would determine either or both cases:

Code:
#include <stdio.h>
#include <stddef.h>

struct struct_header {
	unsigned long offset;
	char magicCookie[4];
	unsigned long unknown;
} typedef struct_header;

int main()
{
	printf("sizeof %u %u \n", sizeof(struct_header), sizeof(unsigned long));
	printf("offset %u %u\n", offsetof(struct_header,magicCookie), offsetof(struct_header,unknown));
	return 0;
}
Reply With Quote