-
What will be the output of the following C code?
#include <stdio.h>
struct
{
int i;
char a;
};
int main()
{
struct stru;
stru.i = 100;
printf("%d\n", stru.i);
}
-
- Compilation Error
- Garbage value
- Nothing
- 100
- None of these
Correct Option: A
Compilation Error
main.c:6:5: warning: unnamed struct/union that defines no instances
};
^
main.c: In function ‘main’:
main.c:10:9: error: ‘stru’ undeclared (first use in this function)
stru.i = 100;
^~~~
main.c:10:9: note: each undeclared identifier is reported only once for each function it appears in