C Preprocessor - Find Output of Program :: Discussion


5.What will be the output of the program?
A.int=4, int=4, int=4
B.int=3, int=3, int=3
C.int=2, int=2, int=2
D.int=2, int=3, int=4
Answer:  Option  D
Explanation:

The macro PRINT(int) print("%d,", int); prints the given variable value in an integer format.

Step 1int x=2, y=3, z=4; The variable x, y, z are declared as an integer type and initialized to 2, 3, 4 respectively.

Step 2PRINT(x); becomes printf("int=%d,",x). Hence it prints 'int=2'.

Step 3PRINT(y); becomes printf("int=%d,",y). Hence it prints 'int=3'.

Step 4PRINT(z); becomes printf("int=%d,",z). Hence it prints 'int=4'.

Hence the output of the program is int=2, int=3, int=4.

Tutorial Link:
Published by:Michael Daani

Comments are not available

Post your comments here:

Optional

Date to Date Current Affairs 2022

PakMCQs.net

Quick Links

GAT Subject



   Computer Science    English Mcqs    Agriculture    

Engineering



   Computer Science    Civil Engineering    

Technical



   Networking    Electronics    Database    

Past Papers



   Model Papers    FPSC Papers