-
What will be the output of the following C code?
#include <stdio.h>
struct option1
{
int m;
int n;
};
struct option2
{
int m;
int n;
};
int main()
{
struct option1 opt1 = {10};
struct option2 opt2 = opt1;
printf("%d\n", opt2.m);
}
-
- Garbage value
- 0
- 10
- Compilation Error
- None of these
Correct Option: D
Compilation Error
main.c: In function ‘main’:
main.c:15:31: error: invalid initializer
struct option2 opt2 = opt1;