25 Feb 2015

Basic level c practice functions set 2



1.      In the following pgm add a  stmt in the function  fun such that the address of
'a' gets stored in 'j'.
main(){
  int * j;
  void fun(int **);
  fun(&j);
 }
 void fun(int **k) {
  int a =0;
  /* add a stmt here*/
 }
Answer:
                        *k = &a
Explanation:
                        The argument of the function is a pointer to a pointer.
     

1 comment:

  1. Good collection of question, Really help me alot

    ReplyDelete