Top

Discussion

Consider the following three C functions :

[PI] 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 (sizeof(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

Answer: C

No answer description available for this question.

No comment is present. Be the first to comment.
Loading…

Post your comment