#include <iostream>
using namespace std;
int main(){
typedef enum { false, true} boolean;
boolean b = false;
cout<<b;
cin.get();
return 0;
}
The above code is giving error... pls help
You may not use keywords for enumerators. So this declaration
typedef enum { false, true} boolean;
is invalid because false and true are reserved keywords.
You could declare the enumeration the following way
typedef enum { FALSE, TRUE} boolean;
boolean b = FALSE;
Or if you want only to declare an alias for the type bool then you can write simply either
typedef bool boolean;
or
using boolean = bool;
Last edited on
You don't need to attempt that typedef either as bool, true and false are defined as you'd expect.
thnx vlad ......that did it