Goodbye Global Variables
Clare Ruth said she betted I’d blog about getting rid of all the global variables, and now I have!!
I have finally got my coursework for Introduction to Computing (a C program) to a standard Chi Nguyen would be proud of himself! Yesterday I showed it to him and the first thing he said was “You have 12 global variables, do they really need to be global?”. So overnight, and during his lecture the next morning, and the evening after (ie a few hours ago), I removed all global variables and made them local :)
It was a pain in the back end.
It involves passing arrays to functions as pointers and other variables as pointers but it has taught me a lot about C. Now all I have to do is teach Dan what the code does so that he can convincingly answer any questions about it!
sounds thrliing… :S xxx
glad u had a gd evnin
Leave a reply