Initialization of Pointer Variables



Once the pointer variable is declared, it must be properly initialized before it can be used.
Uninitialized pointers can be used but the results are unpredictable. For example, in the statement ,
                                                            int *ptr;
pointer variable ptr doesn’t point to anything. Uninitialized pointer will not cause any compile time error as that of normal variables but if use, give unappropriate results. Pointer variable is of no use until it contains address of some other variable. For this, C provide two operators to work specially with pointers.
1.      Address of operator (&)
2.       Indirection Operator



Previous                                                                                    Next


Powered by Blogger.