int* p; // p is a pointer to int
int i;
I'll give you an example of this.
inti2 = *p; // Assign the target pointed by p to i2
int* p2 = &i; // The target pointed by p2 changes to i (value of p2 = address value of i)
An array is not the same as a pointer, but it can be written like a pointer.
inta[2]; // array with int as elements
int i = *a; // the first element of a is stored in i
int i2 = a[0]; // another way to access the first element of a
inta[2]; // array with int as elements
inti = *(a + 1); // Access to second element
inti2 = a[1]; // another way to access the second element
//a[i] == *(a + i); think of
© 2024 OneMinuteCode. All rights reserved.