Created
May 14, 2019 09:38
-
-
Save avr-programmierung/86e208feb3e4959b200b9796f2b6ab49 to your computer and use it in GitHub Desktop.
ATmega88 @ 8MHz 05
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* code005.c ATmega88 @ 8MHz */ | |
#include <avr/io.h> | |
uint8_t x=2; // Globale Variable x wird deklariert | |
uint8_t addiere(void) | |
{ | |
uint8_t i=2; // (3) i=2 und nur innerhalb der Funktion addiere() gültig | |
x=x+i; // (4) x=4 | |
return i; // (5) i=2 und wird an die aufrufende Funktion übergeben | |
} | |
int main(void) | |
{ | |
uint8_t i=2; // (1) i=2 und nur in der Funktion main() gültig | |
i++; // (2) i=3 | |
x=x+addiere(); // (6) die Funktion addiere wird aufgerufen und der Rückgabewert (i) wird zu x addiert und in x gespeichert | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment