If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register or Login
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Re: Error: Identifer "result" is undefined

Originally Posted by tmcfadden

Here's what this program does.

When I run it it hits the INPUT function and waits for input. Even though the program does not prompt the user to enter something, I tested it by entering integers.
First I entered 1, which allowed me to enter it four times before performing a calculation and returning some obscure values.
I then entered all 2's, which allowed me to enter 13 times before performing a calculation and returning some obscure values.
Finally, I entered 3's which allowed me to enter 34 times before performing a calculation and returning some obscure values.

What I can tell is that it creates and array and does "something" with the numbers, after which is places them in a grid.
But, I can't tell for the life of me what. There's no rhyme or reason to the output.

Time to learn to use your debugger. It will show you exactly what your program is doing and why. That's what any of us would do and it's absolutely indispensable. You cannot write working programs without it. It's not optional.

Re: Error: Identifer "result" is undefined

There's always 'rhyme and reason' to what a program does based upon the code it executes (unless you have a faulty CPU or compiler, which has a probability so close to 0 it can be discounted). The computer, when executing the program, does exactly what it has been told to do - no more and no less. If the program produces output which is at variance with what is expected then either the expectation is wrong or the program is at fault. In your case, you seem to have no knowledge of what the program is supposed to do! So your first step is to look at the program code and walk through it with the debugger as needed and deduce what is its function. You are correct that it performs operations on matrices - but what's that got to do with network socket programming?? If you look at the Input function, you can see that the first number requested is for the number of arrays to be used. Then for each array, it requests the number of rows and the number of columns and then inputs a value for each for these rows and columns. Then repeats for the next array etc.

This should help to make it more clear for you as to the input it requires.

Now you just have to determine what the other functions do (by inspecting the code, walking through it and using the debugger) and then you'll know what the program is supposed to do and what the output means! None of us knows by simply looking at the code what it is supposed to do. We would have to do the same as you and walk through it and use the debugger. A knowledge of matrix mathematics would also be useful!

All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!