C Programming - Complicated Declarations - Discussion

Discussion Forum : Complicated Declarations - Find Output of Program (Q.No. 8)
8.
What will be the output of the program in DOS (Compiler - Turbo C)?
#include<stdio.h>
double i;

int main()
{
    (int)(float)(char) i;
    printf("%d",sizeof(i));
    return 0;
}
4
8
16
22
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
14 comments Page 2 of 2.

Ramanathan said:   1 decade ago
What is the difference between these two
(float) i; and
float i;

It produce the size as 8 and 4 respectively.?

Raj said:   1 decade ago
Initially i is declared as double. So i=8 .

Kickem said:   1 decade ago
In the line <(int)(float)(char) i;> the casts do not modify the type of the variable i, so i is still a Double stored 8 bytes.

Swathi said:   2 decades ago
Can any one explain this?


Post your comments here:

Your comments will be displayed after verification.