Re: c
sundarmeenakshi,
The most insidious errors occur with uninitialized pointers. Suppose a pointer has some random value. You store data and retrieve it using the pointer.
1) *pointer = x.
2) x = *pointer.
This works fine as long as the (random) address represented by the pointer is not used for anything else. If the address is used for something else, then that data (or instruction) at the location represented by the pointer will be destroyed by the the execution of instruction 1 above. Now, here comes the fun part: Suppose you insert a printf statement to try to debug the problem. After recompilation, the random address represented by the pointer is used to hold another piece of data or instruction, and the original problem disappears, only to reappear somewhere else in your program.
.
The use of pointers requries discipline. The number one rule is "aways initialize pointers". If you're lucky, your complier will initialize the pointer value to null (zero), which will result in a run-time error in most environments.
Regards,
Kral