How do I get it to stop printing
when I don't input anything?Code:x is greater than y
How do I get it to stop printing
when I don't input anything?Code:x is greater than y
The code you've quoted defines main with a return type of int, and it also defines two objects of the type int with block scope and automatic storage duration. int was implied in earlier standards when the return type of a function was omitted, but that was changed in the later standards.
Since it's a function definition, it's synonymous "main()". It means that the function accepts zero parameters. "void" just makes that intention clearer.also what does the main(void) mean/do?
It does that when you input a number greater than zero followed by end-of-file or rubbish, not when you don't input anything. You fix that by reading #11.
You mean that the program prints "x is greater than y" before you have typed ANY input AT ALL to the program?
That probably means a configuration problem affecting your build process (i.e. the executable you are running was produced by the compiler/linker from a superseded version of your source code). Delete all the object files and executable files, and rebuild your complete program from source. In an IDE, do "Build Clean" followed by "Build All".
so it works now?
and although i dont look for attaboys, dont forget me! :P lol