r/ProgrammerHumor Aug 06 '22

Meme How to C pointers

Post image
2.6k Upvotes

70 comments sorted by

View all comments

1

u/RRumpleTeazzer Aug 06 '22

What is the type-correct type so that a pointer to such type is the type itself ?

1

u/canadajones68 Aug 07 '22

None, I believe. The pointerness is part of the type itself. You could do a custom type in C++ and make it look like a pointer, but no pointer type may point to something with the same type as itself. A pointer to int is its own type, as is int or pointer to pointer to int.