In order to have better understanding of pointers, I'd like to have this cleared up.
Different data types require different pointers, like char* or int*. Are all these pointers considered to be different data types or are they just the same data type?
Are different pointers considered to be different data types?
Yes.
Different data types require different pointers, like
char*orint*. Are all these pointers considered to be different data types or are they just different types of the same data type?
All are pointers, but their type is different when they point to objects of different type.
Note that beside the difference of the type of the pointer; their size in memory can also be different:
Are there any platforms where pointers to different types have different sizes?
Is the sizeof(some pointer) always equal to four?
Are all data pointers the same size in one platform for all data types?
Can pointers be of different sizes?
How many bytes do pointers take up?
Also there is nothing like "different types of the same data type". Either the type is different or it is the same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With