when I use *ip to initialize the pointer variable, | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

when I use *ip to initialize the pointer variable,

int x; int *ip; *ip = &x; Visual Studio gives an error: Error C2440 '=': cannot convert from 'int *' to 'int' Can someone please explain to me why i get this error?

19th May 2020, 11:36 PM
🌹Ramar🌹
🌹Ramar🌹 - avatar
2 Answers
+ 4
Use ip = &x *ip dereferences and is used to access the value stored at the address held by the pointer ip.
20th May 2020, 12:06 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
20th May 2020, 2:53 PM
🌹Ramar🌹
🌹Ramar🌹 - avatar