Em 10/6/2013 12:36, Manu Abraham escreveu: >> I can't find my K&R book right now, but this should clear that idea up: >> >> >> >> In func() there is this line: >> >> static int x=3D 0; // x is initialized only once across three calls = of func() >> > ugh, Right. > > He could've used the variable in global scope instead.. > > But, still the issue persists that the increments are in the order of 4, > decrements too.. > > Regards, > > Manu Using a static local variable is better than using a file scoped static variable that in turn is better than using a globally accessible variable. The most restricted the scope the better, for safety, logical and clarity reasons. Indeed it is good to have global functions to read and change the values of some variables and have the variables themselves hidden inside a module, similar to what is common in C++ with classes. Isaac --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .