27 views

| 27 views
0

https://csedoubts.gateoverflow.in/9139/pointer-assignment

same concept. It would generate 1006 as output.

+1 vote
let suppose   $int$ $a = 5$  and size of int is $4B$ and add of a is 1000 then
$a+1$ then it will be $6$.
$&a+1$ means address of $a$ +  size of $a$ $= 1000+4 = 1004$
--------------

Come to Question , here $s$ is an array and size of $s$ is $6B$.
$&s+1$ $= 1000+6$
$int$ $*str =$$(int$ $*)1006$ //Array pointer is typecasted to integer pointer.

Now $str$ contain 1006.

It will print $1006$.

let me know if i missed something.
ago by (64 points)
selected ago by