logo

Crowdly

Browser

Add to Chrome

Consider the following C program: #include <stdio.h> #include <stdlib.h> #incl...

✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.

Consider the following C program:

#include <stdio.h>

#include <stdlib.h>

#include <math.h>

double* f(double* q) {

q = malloc(sizeof(double));

*q = log(3.0); // 1.098612

return q;

}

int main(void) {

double x = 9.8;

double* ptr1 = &x;

double* ptr2 = f(ptr1);

printf("%f\n", *ptr2);

free(ptr1);

return 0;

}

Tick all the correct statements.

Penalty for wrong ticks.

0%
0%
0%
0%
0%
0%
0%
More questions like this

Want instant access to all verified answers on moodle.epfl.ch?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome