As a beginner learning pointers, I wrote something like
int i = 1,
j = 2,
k;
k &= i;
i = 3;
Expecting k to point to i, however, I soon found that the mistake is that k is not a int pointer, just an int. But it compiles and run why?
is the short form for
where
&is bitwiseand. It has nothing to do with pointers.If you want to make
kto point toi, you need to make it a pointer:and them to make it point to
i: