Yes! Thank you very much, it did indeed worked.
Last problem this program has is, after inputing anything, it doesent matter, becouse by default all fields are empty, therefore are the same, so immideatly when program has option to check for winners, it says player O won.
Any idea how to make it detect X and O only ? Ignoring the fact all fields are same, becouse they are empty ?
The first error I see, are lines 61 and 70.
The way you have them, looks like they should be within an if-statement etc.
And looking at your check function, it looks fine. Is there a problem with it?
Also, in that function, you don't need the else at the end, just return false, as none of the above statements returned true. (:
I thought they were elseif statements! It only returns false, when the last if-statement is not true!
I find goto very easy to use as i can jump quickly somewhere and put conditions with if's for jump if i need. They seem best kind of loop for me.
If you think gotos are easy, you've never had do debug a program with hundreds of gotos pointing backwards and forwards, and try and figure out how you got to a certain point in the code.
The problem with gotos is not where does it go, but rather "how did I get here"? Consider a program with 14 gotos that all jump to the same label. No way to tell how you got to the label. By comparison, a structured loop (while, do while, for) has an explicit entrance and an explicit exit. No question about the flow of the program.
As a programming manager, if I found one of my programmers using gotos instead of a structured loop, he wouldn't be working for me for very long. I'm not here to bash your code, but rather to try and illustrate why gotos are evil.
No. The use of gotos is the result of either being lazy, lack of coding discipline, not understanding structured programming, or not understanding how to code a proper loop. It doesn't matter if it is one goto or 100. It's still a bad practice.
You say you wouldn't use a goto in a big project. Well programs often start small and frequently morph in much bigger programs. At what point do you go back and recode your program to use proper loops rather than gotos? 10 gotos? 20? 100?
It's possible to create program flow using gotos that you can't easily convert to conventional loops. How much code are you going to have to redo? I don't pay programmers to redo their code. I expect it to be written correctly the first time.
The fact that you're trying to defend the use of goto tells me you don't get it.