Discussion
Pick the best statement for the below program:
#include "stdio.h"
int main()
{
struct {int i; char c;} myVar = {.c ='A',.i = 100};
printf("%d %c",myVar.i, myVar.c);
return 0;
}
Answer: D
Correct answer: No compile error and it’ll print 100 A.
Defining a structure type inline with the variable is legal, and designated initialisers may be given in any order, since each names its target. So .c = 'A', .i = 100 is fine and prints 100 A.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development