Byte (?)

Bytes are 8-bit (1 byte) unsigned integers ranging in value from 0 to 255  ( 0 to 2^8-1).  The type-specifier character for a Byte is: ?.

Byte variables are identified by following the variable name with a question mark (i.e., var?), or by using the DEFBYT statement as described in the previous discussion of Integers.  You can also declare Byte variables using the BYTE keyword with the DIM statement.  For example:

DIM I AS BYTE

Byte variables are particularly useful for storing small, unsigned integral quantities like the number of days in a month.  You should not use Byte variables in FOR/NEXT loops, as they are highly inefficient.

A PowerBASIC Byte variable is equivalent to a bool data type (in lowercase) used by most modern C compilers.  A bool is a non-traditional 8-bit unsigned data type, whereas a BOOL data type (in capital letters) is equivalent to a Long-integer in PowerBASIC.  Be aware that some older C compilers may freely interchange bool and BOOL keywords.

A Delphi byte is equivalent to a PowerBASIC Byte.

 

See Also

Double-word (???)

Integers (%)

Long integers (&)

Quad integers (&&)

Word (??)