i have different structure definitions.cou ld any one tell me why it is not taking the folowing variations
gcc produces the given error :storage size of `p' isn't known
ex2.
gcc produces "storage size of `p' isn't known"
could any one tell me why this above are wrong?
Code:
ex1:
#include<stdio.h>
struct{
int i; // 4 bytes
char c; // 1 byte
char b; // 1 byte
};
main()
{
struct a p;
printf("%d",sizeof(p));
}
ex2.
Code:
#include<stdio.h>
struct {
int i; // 4 bytes
char c; // 1 byte
char b; // 1 byte
}a;
main()
{
struct a p;
printf("%d",sizeof(p));
}
could any one tell me why this above are wrong?
Comment