Duvida typedef void * [duplicate]

2

I'm seeing the following expression:

typedef void* type_t;

So I was doing tests and I put type_t in sizeof and it returned me 4 bytes in size more like that?

    
asked by anonymous 23.12.2015 / 22:10

1 answer

6

void * is a pointer to an arbitrary memory address, not a pointer to "nothing." The fact that you have returned 4 in your implementation means that you have 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.

    
23.12.2015 / 22:14