C语言中的类型

来源:互联网 发布:mac游戏排行好玩的 编辑:程序博客网 时间:2024/06/11 03:16

以下摘自ANSI C标准:

   An object declared as type char is large enough to store any member
of the basic execution character set.  If a member of the required
source character set enumerated in $2.2.1 is stored in a char object,
its value is guaranteed to be positive.  If other quantities are
stored in a char object, the behavior is implementation-defined: the
values are treated as either signed or nonnegative integers.

...

   There are four signed integer types, designated as signed char,
short int, int, and long int. 

...

   For each of the signed integer types, there is a corresponding (but
different) unsigned integer type (designated with the keyword unsigned)
that uses the same amount of storage (including sign information)
and has the same alignment requirements. 

...

   There are three floating types, designated as float , double , and
long double .

...


 * An array type describes a contiguously allocated set of objects
   with a particular member object type, called the element type .Array
   types are characterized by their element type and by the number of
   members of the array.  An array type is said to be derived from its
   element type, and if its element type is T , the array type is
   sometimes called ``array of T .'' The construction of an array type
   from an element type is called ``array type derivation.''

 * A structure type describes a sequentially allocated set of member
   objects, each of which has an optionally specified name and possibly
   distinct type.

 * A union type describes an overlapping set of member objects, each
   of which has an optionally specified name and possibly distinct type.

 * A function type describes a function with specified return type.  A
   function type is characterized by its return type and the number and
   types of its parameters.  A function type is said to be derived from
   its return type, and if its return type is T , the function type is
   sometimes called ``function returning T.'' The construction of a
   function type from a return type is called ``function type
   derivation.''

 * A pointer type may be derived from a function type, an object type,
   or an incomplete type, called the referenced type. A pointer type
   describes an object whose value provides a reference to an entity of
   the referenced type.  A pointer type derived from the referenced type
   T is sometimes called ``pointer to T .'' The construction of a pointer
   type from a referenced type is called ``pointer type derivation.''

...

   The type char, the signed and unsigned integer types, and the
enumerated types are collectively called integral types.

...

   Integral and floating types are collectively called arithmetic
types.  Arithmetic types and pointer types are collectively called
scalar types.  Array and structure types are collectively called
aggregate types.

...

   Array, function, and pointer types are collectively called derived
declarator types.

原创粉丝点击