Q. | What will be output if you will execute following code? #include
#define int int*
int main(){
int *p,q;
p=(int *)5;
q=10;
printf("%d",q+p);
return 0;
}
|
|||||||
|
Answer: | Option D | |
Explaination: | Here q pointer and p is a number.In c Address + number = Address So, New address = old address + number * Size of data type to which pointer is pointing.
= 5 + 10 * sizeof (*int)
= 5+10*2 = 25.
|
Discussion
Your Comments Goes here... |
Name | Discussion |
---|