From: Martin Ambuhl Newsgroups: comp.os.msdos.djgpp Subject: Re: BOOL crap :) Date: Thu, 31 Dec 1998 02:44:17 -0500 Content-Transfer-Encoding: 7bit References: <368af097 DOT 10898047 AT news DOT w-link DOT net> X-Posted-Path-Was: not-for-mail X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-ELN-Date: 31 Dec 1998 07:44:38 GMT X-ELN-Insert-Date: Wed Dec 30 23:45:07 1998 Organization: Nocturnal Aviation Lines: 52 Mime-Version: 1.0 NNTP-Posting-Host: 1cust29.tnt11.nyc3.da.uu.net Message-ID: <368B2B51.EE7D3CC7@earthlink.net> X-Mailer: Mozilla 4.5 [en] (Win95; I) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com pjotr wrote: > > I recently installed DJGPP along with RHIDE. My problem is, I want to > use the BOOl type variable in my C programs, but for some reason the > compiler does not understand it, eventhough RHIDE acknowledges "bool" > as a valid keyword (e.g. it turns white on screen). > > I tried creating my own BOOL variable type by writing my own header > file "types.h": > > #ifndef TYPES_H > #define TYPES_H > > enum BOOL > { > FALSE = 0, > TRUE = 1; > }; > > #endif /* TYPES_H */ > > But even after this the compiler insists it does not know the BOOL > type... Any sugestions? You could learn how to declare a type: #include typedef enum { FALSE, TRUE } BOOL; int main() { BOOL y[10], i; for (i = 0; i < 10; i++) y[i] = (i % 2) ? TRUE : FALSE; for (i = 0; i < 10; i++) { printf("isodd(%d)? BOOL y[%d]=%5s\n", i, i, (y[i] == TRUE) ? "TRUE" : "FALSE"); } return 0; } The use of i (of type BOOL) as an integer type in the code should suggest to you that you never needed your BOOL type at all. -- Martin Ambuhl (mambuhl AT earthlink DOT net) Note: mambuhl AT tiac DOT net will soon be inactive