-
What will be the output of the following C code?
#include <stdio.h>
struct MansWear
{
int size1;
int size2;
};
struct WomensWear
{
int size1;
int size2;
};
void fun(struct MansWear);
int main()
{
struct WomensWear WW = {39, 42};
fun(WW);
}
void fun(struct MansWear MW)
{
printf("%d\n", MW.size1);
}
-
- Compilation Error
- 39
- 42
- Garbage value
- None of these
Correct Option: A
Compilation Error
main.c: In function ‘main’:
main.c:16:13: error: incompatible type for argument 1 of ‘fun’
fun(WW);
^~
main.c:12:10: note: expected ‘struct MansWear’ but argument is of type ‘struct WomensWear’
void fun(struct MansWear);