I want to know the following:

A pointer is a special type of variable which holds the memory address 
of an int variable or a float variable or a char cariable etc. But all 
it holds is the memory address which is of same type irrespective of 
whether that memory address belonging to an int variable or a float 
variable or a char variable. Yet we always have to define the pointer 
as of the type of the variable it points to. Why can't we simply 
define it as a pointer. It shall anyway hold the memory address and 
later on while dereferencing it, it shall automatically dereference it 
depending on whether the memory address it contained was that of an 
int or a float or a char etc.

I hope someone enriches my knowledge by explaining me the above.

Reply via email to