C Programming Questions and Answers
What is x in the following program?
#include < stdio . h >int main()
{
typedefchar (*(*arrfptr[3])())[10];
arrfptr x;
return0;
}
Option C
What will be the output of the program?
#includetypedefstruct error {int warning, err, exception;} ERROR;
int main()
{
ERROR e;
e.err=1;
printf("%d\n", e.err);
return0;
}
Option B
#include <stdio.h>
typedefstruct student
{
char*a;
}stu;
void main()
{
struct stu s;
s.a="hi";
printf("%s", s.a);
}
Answer: Option A
What is the output of this C code?
#include <stdio.h>
typedefstruct student
{
char*a;
}stu;
void main()
{
struct student s;
s.a="hey";
printf("%s", s.a);
}
Answer: Option D
What is the output of this C code?
#include <stdio.h>
typedefint integer;
int main()
{
int i =10,*ptr;
float f =20;
integer j = i;
ptr =&j;
printf("%d\n",*ptr);
return0;
}
Answer: Option D