Today’s lesson: Initialize your variables

Methinks that's a bit high...

Methinks that’s a bit high…

For my assignment this week, we’re practicing writing and calling functions, and passing values between them. I spent far longer than I’d like to admit on this yesterday. While I finished the program last night, it wasn’t until this afternoon that I worked all the kinks out of it.

One thing that threw me after I had my professor look over my code and make some adjustments, was I neglected to initialize the “total” function to 0, which gave some interesting results shown in the above picture.

Here’s the code:
Modified Joy of C exercise 2.11

Also, I noticed today that my code pages come up looking UGLY in IE. No surprise there. Chrome for the win.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.