0

Pointer

I read somewhere that : int c, *ptr; *ptr = &c; // is wrong, coz *ptr is the value pointed by address whereas &c is an address. But there are many tutorials out there which uses that. why is that?

9th Mar 2019, 4:38 PM
Tincture
1 Resposta
+ 1
Correct is ptr=&c; *ptr is the value at the address when you assign an address (&c) you assign it to ptr directly
9th Mar 2019, 5:21 PM
michal