mikroElektronika PIC Microcontrollers PIC12 User Manual page 66

Mikroc user's manual
Table of Contents

Advertisement

mikroC - C Compiler for Microchip PIC microcontrollers
Here is an example of two objects with local scope, but with different duration:
void f() {
/* local duration var; init a upon every call to f */
int a = 1;
/* static duration var; init b only upon 1st call to f */
static int b = 1;
/* checkpoint! */
a++;
b++;
}
void main() {
/* At checkpoint, we will have: */
f();
f();
f();
}
page
58
// a=1, b=1, after first call,
// a=1, b=2, after second call,
// a=1, b=3, after third call,
// etc.
MikroElektronika: Development tools - Books - Compilers
mikroC
making it simple...

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?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Pic microcontrollers pic16Pic microcontrollers pic18

Table of Contents