Announcement

Collapse
No announcement yet.

Byte ( )

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Byte ( )

    Please add your comments and suggestions as a Reply to this thread.





    PB/WIN - 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:

    Code:
    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
    Last edited by Gary Beene; 28 Oct 2014, 06:48 PM.
Working...
X