Skip to content

Instantly share code, notes, and snippets.

@lseongjoo
Last active December 11, 2015 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lseongjoo/4616705 to your computer and use it in GitHub Desktop.
Save lseongjoo/4616705 to your computer and use it in GitHub Desktop.
C++ post increment usage
int sum_elements(int[] array, int numOfElements)
{
int sum = 0;
int index = 0;
while(index < numOfElements)
sum += array[index++];
return sum;
}
int a=5;
int b;
b = a++;
b = a++;
b = a;
a = a + 1;
a = a+1;
b = a;
x = x+1;
x += 1;
++x;
sum = sum + array[index];
index = index + 1;
int n = 0;
while(n++ < 10)
cout << "Number of execution: " << n << endl;
int n=0;
while(n<10){
n=n+1;
cout << "Number of execution: " << n << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment