Main.cc: In function 'int main()': Main.cc:6:16: error: 'n' was not declared in this scope for(int i=1;i>=n;i++){ ^ Main.cc:7:5: error: invalid type argument of unary '*' (have 'int') a=*i; ^