Hot answers tagged

2

Actually, it's not really anything to do with the code you've typed in. Its the clang compiler complaining. The breakout.c program would also suffer the same fate if clang was not told to suppress the error in the Makefile definition file. For breakout it contains the following option: -Wno-unused-variable -W is the command line option relating to a ...


2

Change when declared inside the loop has local scope, and that's why compiler isn't able to recognize it, try declaring it before the loop. float Change; do { printf ("How much change do you owe?\n"); Change = GetFloat(); } while (Change < 0); Hope that helps!


1

There are a few simple issues. First, octave is being declared and then redeclared, but, amusingly, that isn't the actual problem. The real problem is that they are being declared inside of code blocks attached to the if/else statements. That means that after the closing curly brace after each declaration, they go out of scope and cease to exist! You ...


1

Your instincts are more or less correct. You have actually declared key twice, once as a global and a second time as a local var inside main(). Specifically, the line int key = atoi(argv[1]); is the second declaration and it takes precedence over the global var, so any usage of key inside of main will use the local version. The actual error is that once ...


Only top voted, non community-wiki answers of a minimum length are eligible