gcc – C – error: storage size of ‘a’ isn’t known

gcc – C – error: storage size of ‘a’ isn’t known

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(%dn, 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

gcc – C – error: storage size of ‘a’ isn’t known

you define the struct as xyx but youre trying to create the struct called xyz.

Leave a Reply

Your email address will not be published.