It might help to actually use pointers.
Code:
#include <stdio.h>
#include <stdlib.h>
void display(int *pointer) {
printf("value of variable: %d, address of variable: %p \n", *pointer, (void *)pointer);
}
int main(void) {
int number = 100;
int *pointer;
/* one way to use pointers is to take the address of a normal variable.
this lets you use a variable using another name, which may be
necessary. for instance, you may need to call functions with pointers
in the signature. */
pointer = &number;
display(pointer); /* same as display(&number); */
/* another important reason to use pointers is dynamic memory (sometimes called
heap memory) from allocation functions like malloc. using a pointer is the only
way to refer to this memory by name, use it, or change it. */
pointer = malloc(sizeof(*pointer)); /* same as sizeof(int) */
/* always check the return value of allocation functions */
if (pointer == NULL) {
perror("malloc");
return 0;
}
/* at this point, with the memory acquired, we can give the memory a value by
dereferencing. do this to change anything. */
*pointer = number;
*pointer *= 2;
++(*pointer);
/* you will notice that the memory has a completely different address from number */
display(pointer);
/* free memory from malloc. */
free(pointer);
return 0;
}
value of variable: 100, address of variable: 000000000062FE44
value of variable: 201, address of variable: 0000000000196A90
I still recommend the Binky video for one's first introduction to pointers:
YouTube