-----------------------------------------------------------
output will be
X X
because ptr1 point to the var2 and var2 contain value 'x';
Not necessarily. At that point dereferencing an uninitialized pointer has caused undefined behavior. After that, nothing is guaranteed to work, even if it would otherwise.
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Offline 11,807 posts
since Sep 2004