hi,

this seems like homework, doesn't it_ EE forbids writing homeworks, so I'll give you only few clues what to fix and how to continue:

First declare a square in which you'll store the numbers. You're storing them to the same variables over and over (forgeting the previous values)

Same is for checkXXX() functions. You sum whole square together. you should store the sub-sums for every row separately.

like this:

void checkRows (int square[][4], const int magicvalue) {

for (i=0; i<4; i++)

sum = 0 ;

for (j=0; j<4; j++)

sum += square[i][j] ;

if (sum == magicvalue)

// line i sums to magic value

else

// line i doesn't sum to magicvalue

}

S.

this seems like homework, doesn't it_ EE forbids writing homeworks, so I'll give you only few clues what to fix and how to continue:

First declare a square in which you'll store the numbers. You're storing them to the same variables over and over (forgeting the previous values)

Same is for checkXXX() functions. You sum whole square together. you should store the sub-sums for every row separately.

like this:

void checkRows (int square[][4], const int magicvalue) {

for (i=0; i<4; i++)

sum = 0 ;

for (j=0; j<4; j++)

sum += square[i][j] ;

if (sum == magicvalue)

// line i sums to magic value

else

// line i doesn't sum to magicvalue

}

S.