#include <iostream>
using namespace std;
int main ()
int a, b;
int result;
result = a - b; ERROR = C++ requires type specifiers for all declarations
I'm having an issue with this type specifier, i've attempted the type specifier of ENUM, but Xcode rejects this. i am confused as how to specify my declaration. Or what to put, i am a beginner and am trying to learn on the go. ANY help would be greatly appreciated! Thanks in advance.
Welcome to the forums:) Are you getting the error at compile- or run-time? It should compile, I think, but because you dont assign any values to the variables you will most likely get random values when you run it. Also, you should use code tags when posting code:)
it is not compiling, period. I made a slight error when posting my code.
my code is actually:
int a , b;
int result;
a= 4; Error - C++ requires type specifiers for all declarations.
b= 1; Error - C++ requires type specifiers for all declarations.
result = a - b; Error - C++ requires type specifiers for all declarations.
Basically, what type specifier is the error referring to? I've attempted to use ENUM, as stated in my original post but can't understand what i should do.
Sorry fafner, I'm new to the forum as well as C++. Im not sure what you mean by posting the tags along with my code, could you elaborate? Anyone else that can provide a solution to my problem?
Hmm, this is weird, this compiles and runs just fine for me. If you're using XCode, try to clean and rebuild.
Also, when posting code you should enclose that code with the tags code and /code, inside square brackets. If you look at the menu called "Format", there's an option to put them in automatically. That way the code appears with color-coding and is easier to read:)