Here the array [i ++] increments the index number.
Conversely, the [i] ++ array increments the value of index i data.
Code snippet:
#include <iostream> using namespace std; int main() { int array[] = {5, 2, 9, 7, 15}; int i = 0; array[i]++; printf("%d %d\n", i, array[i]); array[i]++; printf("%d %d\n", i, array[i]); array[i++]; printf("%d %d\n", i, array[i]); array[i++]; printf("%d %d\n", i, array[i]); return 0; }
source share