<<< Pointer is a also variable | Index | Pointer dereference *ptr >>> |
The pointers provide indirect access to our variables. For example,
int main( ) { // Local variables: int x = 5; double d = 0.1; // We need pointers to store addresses: int* x_ptr = &x; double* d_ptr = &d; // Use pointers to modify variables: *x_ptr = 10; // same as x = 10; *d_ptr = 0.2; // same as d = 0.2; return 0; }
But what is the asterisk * doing in front of the pointer???
<<< Pointer is a also variable | Index | Pointer dereference *ptr >>> |