When I have following:
#include "stdafx.h" #include<stdio.h> int main() { int val1,val2; printf("Enter the first value"); scanf("%d",val1); scanf("%d",&val2); int c; c=val1 + val2; printf(" the value is : %d", c); return 0; // 0 means no error } I get error undeclared identifier c. Also, syntax error. missing ; before type.
However, if I change above to following error disappears. Please help
#include "stdafx.h" #include<stdio.h> int main() { int val1,val2,c; printf("Enter the first value"); scanf("%d",&val1); scanf("%d",&val2); c=val1 + val2; printf(" the value is : %d", c); return 0; // 0 means no error } I am running C in VS 2010.