porting arduino to c, keywords question


I'm trying to port some Arduino code to a microcontroller in c.

byte ZERO = 0x00;
boolean EndFlag=0;

Are the byte and boolean keywords in Arduino supported in c?

Many thanks

It depends on which version of C your micro compiler supports.

Here's a wikipedia entry on the C data types.

If you need them, just define the missing datatypes in a header file:

typedef unsigned char byte;

boolean is a little trickier, but for your purposes, maybe this is OK:

typedef unsigned char boolean;

You can probably/possibly use "bool" instead of "boolean".
Which compiler/micro?


The header stdbool.h in the C Standard Library for the C programming language contains four macros for a Boolean data type. This header was introduced in C99.

The macros as defined in the ISO C standard are :

bool which expands to _Bool
true which expands to 1
false which expands to 0
__bool_true_false_are_defined which expands to 1

Sorry arduinodlb, I just realised that you pointed out exactly the same thing in your last post. :frowning: