C - error: storage size of ‘a’ isn’t known
129,407
Solution 1
Your struct is called struct xyx
but a
is of type struct xyz
. Once you fix that, the output is 100
.
#include <stdio.h>
struct xyx {
int x;
int y;
char c;
char str[20];
int arr[2];
};
int main(void)
{
struct xyx a;
a.x = 100;
printf("%d\n", a.x);
return 0;
}
Solution 2
To anyone with who is having this problem, its a typo error. Check your spelling of your struct delcerations and your struct
Solution 3
you define the struct as xyx but you're trying to create the struct called xyz.
Solution 4
correct typo of
struct xyz a;
to
struct xyx a;
Better you can try typedef, easy to b
Solution 5
Say it like this: struct xyx a;
Author by
user361697
Updated on July 22, 2021Comments
-
user361697 almost 3 years
This is my C program...
#include <stdio.h> struct xyx { int x; int y; char c; char str[20]; int arr[2]; }; int main(void) { struct xyz a; a.x = 100; printf("%d\n", a.x); return 0; }
This is the error that I am getting....
Press ENTER or type command to continue
13structtest.c: In function ‘main’: 13structtest.c:13:13: error: storage size of ‘a’ isn’t known 13structtest.c:13:13: warning: unused variable ‘a’ [-Wunused-variable]