-
What will be the output of the following C code?
#include <stdio.h>
struct car
{
int car_no = 12;
char car_name[25];
};
void main()
{
struct car c;
c.car_no = 10;
printf("Audi");
}
-
- 10
- Compilation Error
- Audi
- Garbage value
- None of these
Correct Option: B
Compilation Error
main.c:4:20: error: expected ‘:’, ‘,’, ‘;’, ‘}’ or ‘__attribute__’ before ‘=’ token
int car_no = 12;
^
main.c: In function ‘main’:
main.c:10:10: error: ‘struct car’ has no member named ‘car_no’
c.car_no = 10;