Question: Non-converting type cast - example: In C interpret the bits in an integer as a float: int n; float f; ... f =*((float *) &n);

Non-converting type cast - example:

In C interpret the bits in an integer as a float:

int n;

float f;

...

f =*((float *) &n); // can achieve this effect with pointers

Write a small fragment of code that shows how unions can be used in C to interpret the bits of a value of one type as if they represented a value of some other type (non-converting type cast)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!