DEV Community

Discussion on: Basic "C Pointer" Concepts for Beginners

Collapse
 
kaisarh profile image
kaisarh

"int X = 10, means X is an integer type variable which takes 2 bytes in memory (in some cases 4 based on compiler type), holding the value 10."

This is true for 16 bit compilers, however today almost all 32/64 bit compilers will have 4 bytes for int.

"a memory space is created which is big enough to hold a memory address (usually 8 to 16 bytes depending on the nature of the hardware)."

Sizeof pointer is 32 bit in 32 bit machines and 64 bit in 64 bit machines. So it should be 4 and 8 bytes.