Pointers

I haven’t checked the other discussions yet and I am a complete novice in programming, but here is my understanding of pointers:

Pointers are variables usually assigned to addresses using the * symbol, read as “value pointed to by,” and the & (ampersand) symbol, read as “address of,” in the following manner:

int *p = &value

Now the “p” variable is a pointer assigned to the address of the “value” variable. If the pointer is later used without the *, the compiler will use the address of “value”. But if used as “*p,” the compiler will read “value pointed to by p”, with “p” being the address of “value.”

I get the concept but I really want to see it in action to understand its utility in different contexts.

Privacy & Terms