Discuss Question on 2d array. in the C Programming forum on Dev Shed. Question on 2d array. C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
Posts: 5,538
Time spent in forums: 2 Weeks 4 Days 2 h 38 m 46 sec
Reputation Power: 242
First, move your srand() outside your loop! You are reinitializing the random number generator with each loop, thus (since time will likely be an invariant for the duration of the execution) filling each row with the same numbers.
Second, howzatbout tossing in a linefeed after your for j loop?
It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
--Me, I just made it up
The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
--George Bernard Shaw