Q. | What will be output if you will execute following code? #include
int * function();
int main(){
auto int *x;
int *(*ptr)();
ptr=&function;
x=(*ptr)();
printf("%d",*x);
return 0;
}
int *function(){
static int a=10;
return &a;
}
|
|||||||
|
Answer: | Option C | |
Explaination: | Here function is function whose parameter is void data type and return type is pointer to int data type. x=(*ptr)()
=> x=(*&functyion)() //ptr=&function
=> x=function() //From rule *&p=p
=> x=&a
So, *x = *&a = a =10
|
Discussion
Your Comments Goes here... |
Name | Discussion |
---|