C Programming - Pointers - Discussion

Discussion Forum : Pointers - Point Out Correct Statements (Q.No. 3)
3.
Which of the statements is correct about the program?
#include<stdio.h>

int main()
{
    float a=3.14;
    char *j;
    j = (char*)&a;
    printf("%d\n", *j);
    return 0;
}
It prints ASCII value of the binary number present in the first byte of a float variable a.
It prints character equivalent of the binary number present in the first byte of a float variable a.
It will print 3
It will print a garbage value
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
50 comments Page 4 of 5.

Shankar said:   1 decade ago
GLOBAL variables are store in permanent storage area i.e static memory.

Kiran said:   1 decade ago
Global variables are stored on heap.

Suresh said:   1 decade ago
Can you explain how the output get -61?

Sunil patidar said:   1 decade ago
@kiran Global variables are stored on data segment.
the static variables are stored on heap.

Gyni said:   1 decade ago
What is heap? can you segment and static memory storage.

Lalit Singh said:   1 decade ago
The answer to this question is wrong it's option D.

Harry said:   1 decade ago
Can anyone please explain ? How did this answer come ?

Priya said:   1 decade ago
Hut the output is -61 and it is not ASCII value of a so anyone can explain this ans?

Madhureddy said:   1 decade ago
Since here type conversion from float to charecter take place. Hence the ASCII value of the binary number present in the first byte of float variable a will print.

Rupinderjit Singh said:   1 decade ago
Static variables are stored on stack and Heap is only used for dynamic memory allocation.


Post your comments here:

Your comments will be displayed after verification.