guessing game

This is a discussion on guessing game within the C Programming forums, part of the General Programming Boards category; I am very new at C , Any help would be greatly appreciated
This function is made to check the ...

guessing game

I am very new at C , Any help would be greatly appreciated
This function is made to check the 2d array if guess matches num and loop untill the user enters -1.
the function call is not the problem its the return.

can you post your full code so we can see how its being called and what variables are what when passed.

i was trying to understand what the parameters were... the function is to find a number in a 2-dimensional array right? with the 2nd parameter being an initial guess? also this is an A x A (square) array right, so why not use a[SIZE][SIZE] in the parameter list?

All I can think of is to add some temporary printf statements to check to see if it's getting to some parts of your loop. As a side note, a break in an inner loop will not cause the outer loop to also break, but seeing a "return" in there, it would just terminate the whole function whether or not the loops' conditions are true or false.

if the function is supposed to search through the entire array for the number, it isnt working. for the first iteration it compares the number given by the user with table[0][0]. if they arent equal it will read another number, and compare that to table[0][1], and so on. is this what you want?

if you want to guess a number and check the entire array for at least one occurance of it, you need to rethink your loops and move stuff around.. go through on paper what is happening in your Find function and you will see your simple mistake.

As a side note, why are you returning the value of 1 to break to the loop? That is generally used as an error detection value. Return 0 if possible if you are returning a value to the OS, and use return 1 for error value returns for say, if you cant open a file.