Doubt typedef void*

Asked

Viewed 148 times

2

You guys, I’m watching the next show:

typedef void* type_t;

so I was doing some tests and I put type_t in a sizeof and it returned me 4 bytes more size as well ?

1 answer

7

void * is a pointer to an arbitrary memory address, not a pointer to "nothing". The fact that it has returned 4 in its implementation means that you are with a 32-bit application (where memory addresses are represented in 4 bytes). If you compile the same code in a 64-bit application (or some other value), the result of sizeof will be different.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.