Monday, February 23, 2009

Programming Tips

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))
Author : Jatin Gandhi

0 nhận xét:

Post a Comment