Xiana Z.

asked • 10/03/20

what is the specific reason behind getting these two warning? (need an extended explanation)

#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); }

After compiling the following code I got .

main.c:17:9: warning: return makes pointer from integer without a cast

main.c:25:4: warning: assignment makes integer from pointer without a cast

but it still showed the correct ANSWER WHICH IS 210 . (I did run it in a c language based compiler)

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.