Floating Point Issues - Find Output of Program :: Discussion


5.What will be the output of the program?
A.4, 4, 4
B.4, 8, 8
C.4, 8, 10
D.4, 8, 12
Answer:  Option  C
Explanation:

sizeof(3.14f) here '3.14f' specifies the float data type. Hence size of float is 4 bytes.

sizeof(3.14) here '3.14' specifies the double data type. Hence size of float is 8 bytes.

sizeof(3.14l) here '3.14l' specifies the long double data type. Hence size of float is 10 bytes.

Note: If you run the above program in Linux platform (GCC Compiler) it will give 4, 8, 12 as output. If you run in Windows platform (TurboC Compiler) it will give 4, 8, 10 as output. Because, C is a machine dependent language.

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