Discussion :: C Preprocessor - Point Out Errors (Q.No.2)
|Meena said: (Sep 17, 2011)|
|Can we include the prreprocessors inside the program?|
|Preeti said: (Dec 19, 2012)|
|Yes I think. Because the above program gives output without errors when elif is replaced by endif.|
|Huma said: (Mar 16, 2013)|
|Yes we can define macros within main().|
|Jagadesh said: (Oct 12, 2014)|
|int main ( )
Can any one give me the output?
|Shekhar said: (Dec 16, 2014)|
Infinite loop as the for loop will execute infinite number of scanf statements and therefore printf also. If still doubt, do comment. :).
|Vishalakshi said: (Dec 7, 2016)|
You are right @Shekhar. It gives an infinite loop.
|Rohan said: (Jun 10, 2018)|
|Here it is;
Step 1: a variable(i) is declared.
printf("Enter any number:");
Step 2: (i) Macro() or preprocessor can be used inside main() function..
(ii) It will execute the if condition
printf("The number is odd");
Step 3: It will execute elif part too but #endif is missing from this program and so it will give an error.
|Shubh said: (Mar 21, 2020)|
|What is the A and B means?|
|Ritik said: (Aug 25, 2020)|
|A and B are macros @Shubh.|
|Amol Pansare said: (Jul 8, 2021)|
Very good explanation, Thanks.
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.