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]
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;
}
To anyone with who is having this problem, its a typo error. Check your spelling of your struct delcerations and your struct
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With