Which of the following is not a valid call to myFunction voi
Which of the following is not a valid call to myFunction:
void myFunction(int *c){
*c = 10;
}
int main( ){
int *a = new int;
int b = 5;
int *a2 = &b;
//call myFunction here
}
Select one:
a. myFunction(a);
b. myFunction(&b);
c. myFunction(a2);
d. myFunction(&a);
Solution
Ans) d myFunction(&a);
Reason:
\'a\' is a pointer type variable.Again we no need to pass the address of \'a\' as input to the function.Which is invalid.
