I was told that you are suppose to declare your variables in your functions
That's a very broad statement. main IS a function so if you are going to use a variable in main and you don't want to declare it globally, which you usually don't, and you haven't done so here, you need to declare it in main.
Reputation Points: 2614
Solved Threads: 687
Posting Expert
Offline 5,374 posts
since Jan 2008