Posts

XIIB-CS (POINTERS- NOTE)

POINTERS Key points to remember: Pointer: •           A kind of memory variable that holds the address of other variable of same data type. •           Reference operator (&) As soon as we declare a variable, the amount of memory needed is assigned for it at a specific location in memory (its memory address). •          This reference to a variable can be obtained by preceding the identifier of a variable with an ampersand sign ( & ), known as reference operator, and which can be literally translated as "address of ". For example: ted = &andy; Consider the following code fragment: andy = 25; fred = andy; ted = &andy; The values contained in each variable after the execution of this, are shown in the following diagram: First, we have assigned the value 25 to andy (a variable whose address in memory we ...