English
Language : 

CC78K4 Datasheet, PDF (59/523 Pages) NEC – CC78K4 Ver.2.30 or Later, C Compiler Language
CHAPTER 3 DECLARATION OF TYPES AND STORAGE CLASSES
3.4 Declarators
A declarator declares an identifier. Here, pointer declarators, array declarators, and function declarators are
mainly discussed. The scope of an identifier and a function or object that has a storage duration and a type are
determined by a declarator.
A description of each declarator is given below.
3.4.1 Pointer declarators
A pointer declarator indicates that an identifier to be declared is a pointer. A pointer points to (indicates) the
location where a value is stored. Pointer declaration is performed as follows.
* type qualifier list identifier
By this declaration, the identifier becomes a pointer to T1.
The following two declarations indicate a variable pointer to a constant value and an invariable pointer to a
variable value, respectively.
const int *ptr_to_constant;
int *const constant_ptr;
The first declaration indicates that the value of the constant “const int” pointed by the pointer “ptr_to_constant”
cannot be changed, but the pointer “ptr_to_constant” itself may be changed to point to another “const int”. Likewise,
the second declaration indicates that the value of the variable “int” pointed by the pointer “constant_ptr” may be
changed, but the pointer “constant_ptr” itself must always point to the same position.
The declaration of the invariable pointer “constant_ptr” can be made distinct by including a definition for the
pointer type to the int type data.
The following example declares “constant_ptr” as an object that has a const qualifier pointer type to int.
typedef int *int_ptr;
const int_ptr constant_ptr;
3.4.2 Array declarators
An array declarator declares to the compiler that an identifier to be declared is an object that has an array type.
Array declaration is performed as shown below.
type identifier [constant expression]
By this declaration, the identifier becomes an array that has the declared type. The value of the constant
expression becomes the number of elements in the array. The constant expression must be an integer constant
expression which has a value greater than 0. In the declaration of an array, if a constant expression is not specified,
the array becomes an incomplete type.
In the following example, a char type array “a[ ]”, which consists of 11 elements and a char type pointer array
“ap[ ]”, which consists of 17 elements, have been declared.
char a[11], *ap[17];
User’s Manual U15556EJ1V0UM
59