lines 7 and 8 are incorect. Array elements are counted from 0 up, but not including the max index number. For example scores has valid index values of scores[0][] and scores[1][] The <= operator on line 7 will attempt to dereference scores[2][], which does not exist.
The correct code for line 7 would replace <= with just <.
line 10 is also in error. You have to pass a pointer to scores by adding & pointer operator. scanf("%d", &scores[i][j]);
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
Even though AD explained the problem, I have to add to it:
hey, this is supposed to collect data into a 2 by 3 array. believe it or not, my teacher wrote this problem and he spent 20 minutes trying to figure out why it wasn't running properly. anyone care to help me figure out what was wrong with it??
Given that explanation, what are we supposed to be looking for? "...why it wasn't running properly" means what? What is unproper about it? What are we looking for?
"...what was wrong with it??" depend on what it's doing.
When you need help, please explain what we're looking for, why you claim it's not working. It really saves us from guessing.
WaltP
Posting Sage w/ dash of thyme
10,506 posts since May 2006
Reputation Points: 3,348
Solved Threads: 944
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
sir found the error about a week ago..sad to say i lost the finished program
Man! Isn't that bad luck? Just when you found the error, you lost the program. Life ain't fair.
I'm glad you found the Internet, though! ;)
Aia
Nearly a Posting Maven
2,392 posts since Dec 2006
Reputation Points: 2,224
Solved Threads: 218