Answer SL44

Works, but Not Ideal


Same answer, again!


PS C:\Source>gcc sumVersion4.c 
PS C:\Source>a
sum: 55
PS C:\Source>

Comments:

The variable sum now has block scope but is implemented in static memory. So it is initialized to zero before the program starts and the program works correctly. But it is more sensible to keep the variable automatic and explicitly initialize it as in the first version of the program.



Back to Puzzle Home