Skip to content

Instantly share code, notes, and snippets.

@atton
Created July 8, 2012 06:44
Show Gist options
  • Save atton/3069690 to your computer and use it in GitHub Desktop.
Save atton/3069690 to your computer and use it in GitHub Desktop.
increment-test(gcc4.2.1)
#include <stdio.h>
int test(void){
int n = 2;
n = ++n;
printf("%d\n",n); // 3
return 0;
}
int hoge(void){
int n = 2;
n += ++n;
printf("%d\n",n); // 6
return 0;
}
int fuga(void){
int n = 2;
n += n++;
printf("%d\n",n); // 5
return 0;
}
int main(int argc, char const* argv[]){
test();
hoge();
fuga();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment