Predict the output of following C programs.
Output: Compiler Error
There is an extra space in macro declaration which causes fun to be raplaced by (x). If we remove the extra space then program works fine and prints “GeeksforGeeks” 50 times. Following is the working program.
Be careful when dealing with macros. Extra spaces may lead to problems.
Output: Hello All Geeks 11
The printf() function returns the number of characters it has successfully printed. The comma operator evaluates it operands from left to right and returns the value returned by the rightmost expression (See this for more details). First printf(“Hello”) executes and prints “Hello”, the printf(” All Geeks “) executes and prints ” All Geeks “. This printf statement returns 11 which is assigned to i.
Please write comments if you find any of the answers/explanations incorrect, or you want to share more information about the topics discussed above