Why do you have to add & sign when initialising a pointer
Why do you have to add & sign when initialising a pointer.
Like the &sign is for a reference. Right? Why do you have to make a reference to initialise or assign a pointer
int val = 0;
int *p = &val;
std::cout << *p << std::endl;
Oh sry I found the answer:A pointer holds the address of another object. We get the address of an object by usin the address-of operator (the & operator)
Topic archived. No new replies allowed.