Also note that, like integer pointers, we can also have char
pointers or float pointers.
For example,
char *ptr1;
float *ptr2;
This means that *ptr1 and *ptr2 are pointing to float value and char value, respectively. It does
not mean that *ptr1 contains a char value or *ptr2 contains a float value. Actually, pointer
variables are of uniform size regardless of what they point to.
Just like ordinary variables, we can also write multiple pointer declarations in one line as
follows:
int *ptr1, *ptr2, *ptr3;
But please remember that we store the address of a data type into a pointer of the same
data type. This means that an integer pointer can hold the address of an integer variable, a float
Do'stlaringiz bilan baham: |