Pointers are one of the most powerful and complicated featuresof C++. They enable us to store the memory address of anothervariable, and use this memory address to access and modify thevariable. Consider the following C++ code:
float var = 4.2;float *ptr = &var;*ptr = 1.7;
Rule 1: Whenever we use * in a variabledeclaration between the data type and the variable name, we aredeclaring a pointer variable. In line two above we have declaredptr to be a pointer.
Rule 2: Whenever we use & just before avariable name, we are asking for the address of the variable. Inline two above, ptr is initialized
OR
OR