Main.cc: In function 'int main()': Main.cc:18:11: error: 'j' was not declared in this scope cnt=a[j]; ^