Last active
August 29, 2015 14:20
-
-
Save mprymek/f330f1de20cf84e5371f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
### prvni priklad: a++ jako VYRAZ | |
$ cat >test1.c <<EOF | |
#include<stdio.h> | |
int main() { | |
int a = 5; | |
printf("%d\n",a++); | |
return 0; | |
} | |
EOF | |
$ make test1 | |
cc -O2 -pipe test1.c -o test1 | |
$ ./test1 | |
5 | |
### druhy priklad: ++a jako VYRAZ | |
$ cat >test2.c <<EOF | |
#include<stdio.h> | |
int main() { | |
int a = 5; | |
printf("%d\n",++a); | |
return 0; | |
} | |
EOF | |
$ make test2 | |
$ ./test2 | |
6 | |
### treti priklad: a++ jako PRIKAZ | |
$ cat >test3.c <<EOF | |
#include<stdio.h> | |
int main() { | |
int a = 5; | |
a++; # <-------- a++ jako VYRAZ vrati 5 (tuhle hodnotu nepouzivam, zahodim ji) a jako PRIKAZ zpusobi zvyseni a o jednicku - takze na dalsim radku je a=6 | |
printf("%d\n",a); | |
return 0; | |
} | |
EOF | |
$ make test3 | |
cc -O2 -pipe test3.c -o test3 | |
./test3 | |
6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment