Enumeration Constants; Constant Expressions; Pointer Constants - mikroElektronika PIC Microcontrollers PIC12 User Manual

Mikroc user's manual
Table of Contents

Advertisement

mikroC
making it simple...

Enumeration Constants

Enumeration constants are identifiers defined in enum type declarations. The iden-
tifiers are usually chosen as mnemonics to assist legibility. Enumeration constants
are of
valid.
For example:
enum weekdays {SUN = 0, MON, TUE, WED, THU, FRI, SAT};
The identifiers (enumerators) used must be unique within the scope of the enum
declaration. Negative initializers are allowed. See Enumerations for details of
enum

Pointer Constants

A pointer or the pointed-at object can be declared with the
Anything declared as a const cannot be have its value changed. It is also illegal
to create a pointer that might violate the nonassignability of a constant object.

Constant Expressions

A constant expression is an expression that always evaluates to a constant and
consists only of constants (literals) or symbolic constants. It is evaluated at com-
pile-time and it must evaluate to a constant that is in the range of representable
values for its type. Constant expressions are evaluated just as regular expressions
are.
Constant expressions can consist only of the following: literals, enumeration con-
stants, simple constants (no constant arrays or structures), sizeof operators.
Constant expressions cannot contain any of the following operators, unless the
operators are contained within the operand of a
comma, decrement, function call, increment.
You can use a constant expression anywhere that a constant is legal.
MikroElektronika: Development tools - Books - Compilers
type. They can be used in any expression where integer constants are
int
declarations.
mikroC - C Compiler for Microchip PIC microcontrollers
sizeof
modifier.
const
operator: assignment,
page
45

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?

This manual is also suitable for:

Pic microcontrollers pic16Pic microcontrollers pic18

Table of Contents