Sunday, 6 November 2011

Should variables be stored in local blocks in C programming

The use of local blocks for storing variables is unusual and therefore should be avoided, with only rareexceptions. One of these exceptions would be for debugging purposes, when you might want to declare alocal instance of a global variable to test within your function. You also might want to use a local block whenyou want to make your program more readable in the current context. Sometimes having the variabledeclared closer to where it is used makes your program more readable. However, well-written programsusually do not have to resort to declaring variables in this manner, and you should avoid using local blocks
.
Cross Reference:

 What is a local block

No comments:

Post a Comment