Question 11
#include <stdio.h>
#define get(s) #s
int main()
{
char str[] = get(GeeksQuiz);
printf(\"%s\", str);
return 0;
}
Question 12
#include<stdio.h>
#define A -B
#define B -C
#define C 5
int main()
{
printf(\"The value of A is %d\\n\", A);
return 0;
}
Question 13
#define INC1(a) ((a)+1)
#define INC2 (a) ((a)+1)
#define INC3( a ) (( a ) + 1)
#define INC4 ( a ) (( a ) + 1)
Question 14
#include \"stdio.h\"
#define MYINC ( a ) ( ( a ) + 1 )
int main()
{
printf(\"GeeksQuiz!\");
return 0;
}
Question 15
#define hypotenuse (a, b) sqrt (a*a+b*b);The macro call hypotenuse(a+2,b+3);
Question 16
#include<stdio.h>
#define SQR(x) (x*x)
int main()
{
int a;
int b=4;
a=SQR(b+2);
printf(\"%d\\n\",a);
return 0;
}
Question 20
Typically, library header files in C (e.g. stdio.h) contain not only declaration of functions and macro definitions but they contain definition of user defined data types (e.g. struct, union etc), typedefs and definition of global variables as well. So if we include the same header file more than once in a C program, it would result in compile issue because re-definition of many of the constructs of the header file would happen. So it means the following program will give compile error.
#include “stdio.h”
#include “stdio.h”
#include “stdio.h”
int main()
{
printf(“Whether this statement would be printed?”)
return 0;
}
There are 21 questions to complete.