Xiana Z.

asked • 09/29/20

WHAT IS THE WRONG WITH THIS CODE?

#include <stdio.h>

#include <stdlib.h>

int *get_val(int y) {

int x = 200;

x += y;

return &x;

}

int main() {

int *p, y = 10;

p = get_val(y);

printf("%d\n", *p);

exit(0);

}

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.