Find   


An Affiliate of AIHorizon




This tip submitted by Mounish on 2005-06-22 03:22:28. It has been viewed 27766 times.
Rating of 3.5877 with 114 votes

Initialise all variables before use



Always remember to initialize variables with default values. This is not only a good programming practice but helps prevent logical errors. For instance, it is very helpful to set all pointers to NULL when you declare them; that way, if you accidentally use an uninitialized pointer, you will get a segmentation fault rather than weird memory errors that appear random and are difficult to trace to the root cause.




More tips


Add a tip!



-----
Interested in advertising with us?
Please read our privacy policy.
Copyright © 1997-2005 Cprogramming.com. All rights reserved.