Pointers store the addresses of variables, so the first step to declaring a pointer is to have a variable.
int var = 9;
After you declare your variable, it’s time to make a pointer. Pointers must be the same data type as the variable they are storing. In simple terms, if I’m storing the address of an int in my pointer, I can’t use char. After you have the data type, add an asterisk (*) next to it. Then, give your pointer a name, but not the same one as your variable. Finally, set the pointer equal to &variable_name.
int var = 9; int *ptr = &var;