Hello,
I have a problem that I can’t solve. Can you kindly solve it for me? The problem is like that:-
Consider the following three, C functions:
[P1] int *g(void);
{
int x=10;
return (&x);
}
[P2] int *g(void);
{
int *px;
*px=10;
return px;
}
[P3] int *g(void);
{
int *px;
px=(int*) malloc (size of (int));
*px=10;
return px;
}
Which of the above three functions are likely to cause problems with pointers?
a> Only P3 b> Only P1 and P3 c> Only P1 and P2 d> P1,P2 and P3
Please tell me what will be the answer given above with explation i.e, the detail process to solve this type of problem.
Thank You.