Question: Where did I mess up the code? (See pictures for my code build and ran) ORIGINAL INSTRUCTIONS : Modify the program to cast vptr as

Where did I mess up the code? (See pictures for my code build and ran)

ORIGINAL INSTRUCTIONS:

Modify the program to cast vptr as a float and as a double.

Build and run your program.

THIS IS THE PROGRAM CODE:

#include

int main (void)

{

int intval = 255958283;

void *vptr = &intval;

printf ("The value at vptr as an int is %d ", *((int *) vptr));

printf ("The value at vptr as a char is %d ", *((char *) vptr));

}

MY PROGRAM:

Where did I mess up the code? (See pictures for my code

T! pointer2.c- /home/pi - Geany File Edit Search View Document Project Build Tools Help x6 = Symbols > pointer2.c x Functions #include main (3) int main (void) { int intval 255958283; 6 void *vptr &intval; 8 printf ("The value at vptr as an float is %f ", *((float *) vptr)); printf ("The value at vptr as a double is %1f ", *((double *) vptr)); 1 2 3 4 5 9 10 11 sh X File Edit Tabs Help The value at vptr as an float is 0.000000 The value at vptr as a double is -7211201749376363514499200994595730123471804994 75072271610605513491043694752711168242619704941589400913166362185549378221160168 08561612236989426087830412444553928028713113695962893695617100587634180972644204 06231300836926987370134598827398183865758345337153919592063782093769879466314534 5556537362616569298944.000000 (program exited with code: 0) Press return to continue ES gcc -Wall -o "pointer2" "pointer2.c" (in directory: /home/pi) Compilation finished successfully. Status Compiler Messages line: 11/11 col: 0 sel: 0 INS TAB mode: LF encoding: UTF-8 filetype: C scope: unknown

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!