Pointers and references: Difference between revisions

Content added Content deleted
(+Icon+Unicon)
(→‎{{header|C}} and {{header|C++}}: Use "int *pointer" to indicate that the * is part of the initializer, not the type declaration (that is, "int* a, b" won't work as expected).)
Line 100: Line 100:
The following code creates a pointer to an int variable
The following code creates a pointer to an int variable
int var = 3;
int var = 3;
int* pointer = &var;
int *pointer = &var;
Access the integer variable through the pointer:
Access the integer variable through the pointer:
int v = *pointer; /* sets v to the value of var (i.e. 3) */
int v = *pointer; /* sets v to the value of var (i.e. 3) */