Main.cc: In function 'int main()': Main.cc:8:9: error: redeclaration of 'int n' int n; ^ Main.cc:7:25: note: 'int n' previously declared here int a[1001],b[1001],n,sum=0; ^