Question: Given the following code: #include #include int main ( void ) { int * a , * b; float * c; a = ( int

Given the following code:
#include
#include
int main(void){
int *a,*b;
float *c;
a =(int *) malloc(sizeof(int));
*a =1;
b =(int *) malloc(sizeof(int));
*b =2;
free(a);
free(b);
c =(float *) malloc(sizeof(float));
*c =3.5;
free(c);
return 0;
}
What would be the line
printf("a =%d, b =%d, c =%f",*a,*b,*c);
print to the screen if placed right before the 'return 0;' line
Question 2Answer
a.
a =2, b =2, c =3.5
b.
a =1, b =2, c =3.5
c.
The result is unpredictable and may be different from one system to the next.
d.
a =2, b =3, c =0.5

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 Programming Questions!