Quote:
Originally Posted by poornaMoksha View Post
Its basically used as a dereference or a value-of operator. It is mostly applied to pointers to extract the value at the address held by pointer. Here if you see carefully, you will find that ptr2 is not a pointer. it is declared as an integer.

The catch here is that if you want to declare more than one pointers of same type in a line, then * operator has to be applied with each pointer name rather than with type.

For example, if ptr1 and ptr2 are to be declared as integer pointers then declare them like :

Code:
 int *ptr1, *ptr2; // Correct way
int *ptr1, ptr2; // wrong, as ptr2 here is merely an int
So one should bring in practice of associating * operator with pointer name.



rather than




Hope it helps
Great Explanation! Thanks it really helped!