-
strange errors
Hey guys, I was just trying out some exercises in this textbook I just got here " Programming in C by Kochan." I use the compiler "Borland C++ BuilderX."
While trying this simple program, the compiler gives me an error message that "_Bool" is an undefined symbol!!! This has to be crazy. Here's the code:
Code:
#include <stdio.h>
int main(void)
{
int integerVar = 100;
float floatingVar = 331.79;
double doubleVar = 8.44e+11;
char charVar = 'W';
_Bool boolVar = 0;
printf("integerVar = %i\n", integerVar);
printf("floatingVar = %f\n", floatingVar);
printf("doubleVar = %e\n", doubleVar);
printf("doubleVar = %g\n", doubleVar);
printf("charVar = %c\n", charVar);
getchar();
return 0;
}
-
bool is valid in C++, not in C..
-
hmmm, so kochan is the crazy one afterall... lol
-
One second ping. I just went through iso9899:1999(Programming Languages-C) also called C99 and it does define _Bool.
Section 6.2.5 no.2 defines _Bool as an object large to store the values 0 and 1.so there must be something wrong somewhere!!!
-
well, i guess so, lol.. but, i dont understand how bool entered a C code !!
C has only 5 data types.. void, char, int, double and long
C++ has 2 more .. bool and wchar_t.
-
i was speaking according to the c89 standard... i really dont know about the c99 standard..
:( i really need to get a copy of the c99 standard..
-
Well, ping, even stranger things are happening bcos, wchar_t is featured in c99 as well. lol
-
hey, I downloaded it yesterday. I can send it to you. only 1.33Mb
-
Thanks Dave. Any suggestions of a good IDE I could use...
-
Try Dev CPP - then you should be able to use <stdbool.h> and the _Bool macro.