What will be output if you will compile and execute the following c code?
#include<stdio.h>
#define max 5
void main(){
int i = 0;
i = max++;
printf("%d", i++);
}
#include<stdio.h>
#define max 5
void main(){
int i = 0;
i = max++;
printf("%d", i++);
}
A. 5
B. 6
C. 7
D. 0
E. Compiler Error
Answer: Option E
Solution(By Examveda Team)
main.c: In function ‘main’:main.c:5:12: error: lvalue required as increment operand
i = max++;
Join The Discussion
Comments ( 5 )
Related Questions on C Preprocessor
What is the purpose of the C preprocessor in C programming?
A. Compile C code
B. Optimize code
C. Preprocess code before compilation
D. Execute code
A. #define
B. #include
C. #ifdef
D. #pragma
What is the purpose of the #define directive in C preprocessing?
A. To include a header file
B. To define a macro
C. To declare a constant
D. To declare a variable
In C, which directive is used to conditionally include code based on preprocessor macros?
A. #ifdef
B. #ifndef
C. #if
D. #else
to see header file....statement missing
oh great @ Tej Deep
omg!!
Error in the inclusion of header file will throw an error. Look carefully, after #include nothing is mentioned
cause header file name missing