Overview
Document: The safe-c User Guide
Constants and Data Types
The safe-c User Guide
Using safe-c
safe-c introduces three distinct data types. A data type
is a particular format for storing information of some particular
kind. The three safe-c data types are:
- boolean_type: This only has two possible values,
denoted by the symbolic constants
TRUE and FALSE. It is used particularly when the
behaviour of the program is to depend on whether some condition
is satisfied - whether it is true or not.
- integer_type: For dealing with positive or negative
whole, or integer, numbers. This type cannot be used to
deal with non-integer numbers, such as fractions.
- floating_point_type: This is a special kind of format
which can handle non-integer, rational,
numbers (i.e. there is a decimal
point) but the position of the decimal point is not fixed. That
is, these numbers have a fixed degree of precision - a
fixed number of significant digits - but the decimal point can be
located anywhere. The decimal point is said to float.
Floating points formats are essentially similar to conventional
scientific notation such as
.
- string_type: For storing strings of characters, of
variable length.
safe-c provides functions - or "subprograms" if you like -
to carry out various standard manipulations on objects of these
standard types. Specifically, there are functions to display
strings in the MS-DOS window, and to read strings in from
the keyboard; and to convert between string representations and
the internal binary representations of boolean_type,
integer_type and floating_point_type. In this way,
objects of these types can be read in from the keyboard (as
string_type), converted to one of the internal binary
representations, operated upon in any appropriate way (i.e.
performing boolean or arithmetic operations) and the results can
be displayed again.
Document: The safe-c User Guide
Constants and Data Types
The safe-c User Guide
Using safe-c
McMullin@eeng.dcu.ie
Fri Jan 12 12:30:02 GMT 1996