What will be the output of the following C code?
#include <stdio.h>
typedef struct p
{
int x, y;
}k;
int main()
{
struct p p = {1, 2};
k k1 = p;
printf("%d\n", k1.x);
}
#include <stdio.h>
typedef struct p
{
int x, y;
}k;
int main()
{
struct p p = {1, 2};
k k1 = p;
printf("%d\n", k1.x);
}A. Compile time error
B. 1
C. 0
D. Depends on the standard
Answer: Option B
Related Questions on Structure and Union
Which of the following can be a member of a structure?
A. Function
B. Another structure
C. Enumeration
D. All of the above

Join The Discussion