Datasheet

int modC(char x,char y){
return x%y;
}
//array of pointer to functions that receive two chars and returns
int
int (*arrpf[])(char,char) = { addC ,subC,mulC,divC,modC};
int res;
char i;
void main() {
for (i=0;i<5;i++){
res = arrpf[i](10,20);
}
}
POINTER ARITHMETIC
Pointer arithmetic in the mikroC PRO for AVR is limited to:
- assigning one pointer to another,
- comparing two pointers,
- comparing pointer to zero,
- adding/subtracting pointer and an integer value,
- subtracting two pointers.
The internal arithmetic performed on pointers depends on the memory model in
force and the presence of any overriding pointer modifiers. When performing arith-
metic with pointers, it is assumed that the pointer points to an array of objects.
Arrays and Pointers
Arrays and pointers are not completely independent types in the mikroC PRO for
AVR. When the name of an array comes up in expression evaluation (except with
operators
& and sizeof ), it is implicitly converted to the pointer pointing to array’s
first element. Due to this fact, arrays are not modifiable lvalues.
Brackets
[ ] indicate array subscripts. The expression
id[exp]
161
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroC PRO for AVR
CHAPTER 5