Hi guys, here is my code for sizeof() problem.
#include<stdio.h>
struct student{
char name[30];
int roll_no;
float marks;
};
int main(){
struct student s;
printf("\nSize of Name: %d Bytes.", sizeof(s.name));
printf("\nSize of Roll No: %d Bytes.", sizeof(s.roll_no));
printf("\nSize of Marks: %d Bytes.", sizeof(s.marks));
printf("\nSize of S Total: %d Bytes.", sizeof(s));
getch();
return 0;
}
I don't understand how is 30 + 4 + 4 = 40 ? Anyone have any idea on this one ?