the sizeof why ??!!
Posted
by hiba salem
on Stack Overflow
See other posts from Stack Overflow
or by hiba salem
Published on 2010-03-26T19:18:20Z
Indexed on
2010/03/26
19:23 UTC
Read the original article
Hit count: 713
c++
hi I hve this code
struct Student {
char name[48];
float grade;
int marks[10,5];
char gender;
};
Student s;
Now I have to get the sizeof s
so i added
printf("%d",sizeof(s));
now when I hit compile the result showing is 256
and its wrong because it shoud be 253
as because the size of
char name[48]; ----> 48
and
float grade; -----> 4
and
int marks[10,5]; ------> 200
and
char gender; ------->1
so 48+4+200+1 = 253
so why its telling me 256 ??
© Stack Overflow or respective owner