mikroC
making it simple...
DERIVED TYPES
The derived types are also known as structured types. These types are used as ele-
ments in creating more complex user-defined types.
Arrays
Array is the simplest and most commonly used structured type. Variable of array
type is actually an array of objects of the same type. These objects represent ele-
ments of an array and are identified by their position in array. An array consists of
a contiguous region of storage exactly large enough to hold all of its elements.
Array Declaration
Array declaration is similar to variable declaration, with the brackets added after
identifer:
type array_name [ constant-expression ]
This declares an array named as
The
tion, or another array. Result of the
determines the number of elements in array. If an expression is given in an array
declarator, it must evaluate to a positive constant integer. The value is the number
of elements in the array.
Each of the elements of an array is numbered from 0 through the number of ele-
ments minus one. If the number is
variables
Here are a few examples of array declaration:
#define MAX = 50
int vector_one[10];
float vector_two[MAX];
float vector_three[MAX - 20];
MikroElektronika: Development tools - Books - Compilers
can be scalar type (except
type
array_name [0]
mikroC - C Compiler for Microchip PIC microcontrollers
composed of elements of
array_name
), user-defined type, pointer, enumera-
void
constant-expression
, elements of array can be approached as
n
..
of
array_name [n-1]
/* an array of 10 integers */
/* an array of 50 floats
/* an array of 30 floats
type
within the brackets
.
type
*/
*/
.
page
65
Need help?
Do you have a question about the PIC Microcontrollers PIC12 and is the answer not in the manual?