"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.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
"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.