Definition of standard of computer programms


A C program is a set of tokens defining objects or variables, and functions to operate on these variables. The C language uses a declaration to associate a type to a name. A type may be a simple type or a complex type.A simple type is numerical, and may be integer or real.
Integer Types

An integer type is one of:
char 1 byte
short 2 bytes
int 2 or 4 bytes
long 4 bytes
An object of a given type will occupy the corresponding size in memory, and will be able to hold a different range of values. Note that these
sizes are not defined exactly like that in the ANSI standard, but the
shown values are those commonly used with microprocessors. Note
that shortmay be written short intand that longmay be written long int.
The type intis equivalent either to type shortor to type longdepending
on the target processor capabilities. For most of the existing microprocessors, intis equivalent to shortbecause their internal registers are at
most 16 bits wide. The type intis an important one because it is used as
a reference type for the expressions and for the function arguments. It is
a source of problems when adapting a program to another target processor because its size may also change.
An integer type may be prefixed by the keyword signedor unsignedto
give a more accurate definition of the range of possible values. The
keyword signedmeans that the values hold by the variable may be positive or negative. For instance, a signed charwill hold values from -128
to +127if numbers are represented using the two’s complement convention. This convention is used by all the common microprocessors.
The keyword unsignedmeans that the value heldby the variable is positive only. An unsigned charwill hold values from 0to 255

No comments:

Post a Comment