Jason S wrote:
> I'm working on a program and have encountered a bit of an issue with
> getting my program to work correctly. When I print the array in main(),
> the values print out correctly. But when I debug the program to print
> out their values in the calculatesquares(int[][], int. int) function,
> they come out as very large integers. I assume they might be memory
> addresses? Here's the code:
[...]
> int calculatesquares(int squares[][5], int r, int c)
> {
> int valsAcross[5];
> int valsDown[5];
> int valsDiag[2];
[...]
Just a quick guess, but that looks like uninitialized memory. Could you try:
int valsAcross [5] = {0,0,0,0,0};
...
Best
Kai-Uwe Bux
|