Suraj Jain Suraj Jain - 3 months ago 11
C Question

How does Dereferencing pointer know how much it has to read and from where?

I learned yesterday that a memory address is allocated to the number of bits which the processor is. If it is 32 bit then one address will refer to whole 32 bit and so on.. What i want to know if made a pointer point to a character which is of one byte . Then i print the character value dereferencing pointer than how does it know that which one byte it has to read?

Answer

Yes . According To the Programming Language , It will do so.

For Example if you declare pointer j as int *j then *j will read 4 bytes and *(j+1) will also read 4 bytes . Same goes with char pointer or any other Data Type.