sysy-data/functional_c/sy/78_side_effect.sy

31 lines
530 B
Plaintext
Raw Normal View History

2024-06-02 22:04:54 +08:00
#include "sylib.h"
2024-04-14 22:20:29 +08:00
int a = -1, b = 1;
int inc_a()
{
int b = a;
b = b + 1;
a = b;
return a;
}
int main()
{
int k = 5;
while (k >= 0) {
if (inc_a() && inc_a() && inc_a()) {
putint(a); putch(32); putint(b); putch(10);
}
if (inc_a() < 14 || inc_a() && inc_a() - inc_a() + 1) {
putint(a); putch(10);
b = b * 2;
} else {
inc_a();
}
k = k - 1;
}
putint(a); putch(32); putint(b); putch(10);
return a;
}