0
Size of a pointer
It doesn't matter that for which datatype the pointer is initialised it will always hold an integer value hence it's size will always be 4 https://code.sololearn.com/cLEZ8RI9B2YD/?ref=app
4 odpowiedzi
+ 6
It won't always be 4, it depends on the architecture. Ex. pointers on 64 bit systems are 8 bytes
+ 4
@AMIT KUMAR It still won't always be the same size as a regular int ;). Depending on the compiler, pointers could be 8 bytes while integers could be only 4 bytes.
Compilers may do that for a couple reasons like:
1) backwards compatibility
2) you can store two 32 bit integers in one 64 bit register
3) reducing memory consumption
0
I agree with your point @aklex , it will always be equal to the size of an int that vary acc. to the arch.
0
I didn't know that
thanks @aklex