+ 2

i have a structre related doubt ?

this code works fine:- #include<stdio.h> typedef struct{ int b; }abc; int main() { abc A; A.b = 10; printf("%d",A.b); return 0; } But not this:- #include<stdio.h> struct{ int b; }; int main() { struct A; A.b = 10; printf("%d",A.b); return 0; } Why

8th Jun 2020, 6:28 AM
NIK
NIK - avatar
2 Réponses
+ 2
You didn't declare the structure in the second code correctly struct struct_A{ int b; }; int main() { struct struct_A A; A.b = 10; printf("%d", A.b); return 0; }
8th Jun 2020, 7:00 AM
ogoxu
ogoxu - avatar
+ 2
ROBIN thanks for your help now i understand the error as well ONUR yes now those errors are making sense to me thanks to u both
8th Jun 2020, 7:02 AM
NIK
NIK - avatar