Programming Tips

This tip submitted by Jatin Gandhi on 2005-10-15 13:06:02. It has been viewed 81766 times.
Rating of 5.6 with 660 votes



Here is the simple and most useful tips..,

1) Check for the function prototype for the library function if you don't remember the actual argument type for the library function. e.g., scanf() function.., it expects address of the argument so it should be proveded address of the variable to be filled not the variable itself.

2) Take care that the loop count variable never overflows.., and if so take the overflow into count.
e.g.,
Never expect int variable to count more than 2^( sizeof(int) - 1) (Note : one is substracted for the sign bit.., if it is unsigned we can take full bit length. eg. 2 ^ sizeof(int))





More tips

Help your fellow programmers! Add a tip!