edited by
2,202 views
2 votes
2 votes

What is the output of the following $C$-program

main()
{
    printf("%d %d %d",size of (3.14f), size of (3.14), size of (3.141));
}
  1. 4 4 4
  2. 4 8 10
  3. 8 4 8
  4. 8 8 8
edited by

6 Answers

1 votes
1 votes
4 8 8

Float occupies 4 bytes and double occupies 8 bytes, and long double occupes 8 bytes

Here none of option matches....howz it possible
1 votes
1 votes
answer is: D

Float occupies 8 bytes and double occupies 8 bytes, and long double occupes 8 bytes..

its also depends of compiler ..
0 votes
0 votes
3.14f means floating point value---> so 4

3.14 is by default double hence----->8

3.141 is also by default double hence---->8

So 4 8 8 (using GNU GCC compiler)
0 votes
0 votes

the answer is 4 8 8 (which is not there in options)

"By default,floating constant are stored as double precision numbers.To force the compiler to store a floating constant in floating format,put the letter f(or F) and in long double format put the letter l(or L) at the end "

now 3.14f is stored as float since f is specified at the end ...4 bytes(compiler dependent ofcourse)

3.14,3.141 are stored as double since  no letter at the end.....8 bytes,8 bytes

 

Related questions

0 votes
0 votes
2 answers
1
go_editor asked Mar 27, 2020
1,502 views
What will be the value of $i$ for the following expression:int f=11, i=3 ; i + = (f>3) ? i & 2:5 ;$2$$5$$13$$12$
2 votes
2 votes
2 answers
2
makhdoom ghaya asked Aug 19, 2016
1,577 views
If an integer needs two bytes of storage, then the maximum value of unsigned integer is$2^{16} – 1$$2^{15} – 1$$2^{16}$ $2^{15}$
0 votes
0 votes
1 answer
3
go_editor asked Mar 27, 2020
405 views
The Register or main memory location which contains the effective address of the operand is known as:PointerIndexed registerSpecial LocationsScratch Pad
0 votes
0 votes
1 answer
4
go_editor asked Mar 27, 2020
399 views
A Top - down Parse generatesLeft most derivationRight – most derivationRight most derivation in reverseLeft – most derivation in reverse