Here is a C Program showing some Error, Give some solution
-
#include #include int *val1,*val2; int *oper; void calc(val1,val2,oper) { switch(*oper) { case '+':printf("%d",*val1+*val2); break; case '-':printf("%d",*val1-*val2); break; case '*':printf("%d",*val1 * *val2); break; case '/':printf("%d",*val1 / *val2); break; default:printf("invalied input"); } } void main() { int num1,num2; int oper1; printf("Enter 2 number and an operator\n"); scanf_s("%d%d%d",&num1,&num2,&oper1); //fflush(stdin); calc(&num1,&num2,&oper1); _getch(); } it is showing all of the following ERRORS
Error 2 error C2017: illegal escape sequence c:\users\lina\desktop\project7\project7\source.cpp 33 1 Project7
Error 1 error C2448: 'calc' : function-style initializer appears to be a function definition c:\users\lina\desktop\project7\project7\source.cpp 8 1 Project7
Error 3 error C3861: 'calc': identifier not found c:\users\lina\desktop\project7\project7\source.cpp 33 1 Project7
6 IntelliSense: variable "oper" is not a type name c:\Users\Lina\Desktop\Project7\Project7\Source.cpp 7 21 Project7
4 IntelliSense: variable "val1" is not a type name c:\Users\Lina\Desktop\Project7\Project7\Source.cpp 7 11 Project7
5 IntelliSense: variable "val2" is not a type name c:\Users\Lina\Desktop\Project7\Project7\Source.cpp 7 16 Project7 -
#include #include int *val1,*val2; int *oper; void calc(val1,val2,oper) { switch(*oper) { case '+':printf("%d",*val1+*val2); break; case '-':printf("%d",*val1-*val2); break; case '*':printf("%d",*val1 * *val2); break; case '/':printf("%d",*val1 / *val2); break; default:printf("invalied input"); } } void main() { int num1,num2; int oper1; printf("Enter 2 number and an operator\n"); scanf_s("%d%d%d",&num1,&num2,&oper1); //fflush(stdin); calc(&num1,&num2,&oper1); _getch(); } it is showing all of the following ERRORS
Error 2 error C2017: illegal escape sequence c:\users\lina\desktop\project7\project7\source.cpp 33 1 Project7
Error 1 error C2448: 'calc' : function-style initializer appears to be a function definition c:\users\lina\desktop\project7\project7\source.cpp 8 1 Project7
Error 3 error C3861: 'calc': identifier not found c:\users\lina\desktop\project7\project7\source.cpp 33 1 Project7
6 IntelliSense: variable "oper" is not a type name c:\Users\Lina\Desktop\Project7\Project7\Source.cpp 7 21 Project7
4 IntelliSense: variable "val1" is not a type name c:\Users\Lina\Desktop\Project7\Project7\Source.cpp 7 11 Project7
5 IntelliSense: variable "val2" is not a type name c:\Users\Lina\Desktop\Project7\Project7\Source.cpp 7 16 Project7 -
#include #include int *val1,*val2; int *oper; void calc(val1,val2,oper) { switch(*oper) { case '+':printf("%d",*val1+*val2); break; case '-':printf("%d",*val1-*val2); break; case '*':printf("%d",*val1 * *val2); break; case '/':printf("%d",*val1 / *val2); break; default:printf("invalied input"); } } void main() { int num1,num2; int oper1; printf("Enter 2 number and an operator\n"); scanf_s("%d%d%d",&num1,&num2,&oper1); //fflush(stdin); calc(&num1,&num2,&oper1); _getch(); } it is showing all of the following ERRORS
Error 2 error C2017: illegal escape sequence c:\users\lina\desktop\project7\project7\source.cpp 33 1 Project7
Error 1 error C2448: 'calc' : function-style initializer appears to be a function definition c:\users\lina\desktop\project7\project7\source.cpp 8 1 Project7
Error 3 error C3861: 'calc': identifier not found c:\users\lina\desktop\project7\project7\source.cpp 33 1 Project7
6 IntelliSense: variable "oper" is not a type name c:\Users\Lina\Desktop\Project7\Project7\Source.cpp 7 21 Project7
4 IntelliSense: variable "val1" is not a type name c:\Users\Lina\Desktop\Project7\Project7\Source.cpp 7 11 Project7
5 IntelliSense: variable "val2" is not a type name c:\Users\Lina\Desktop\Project7\Project7\Source.cpp 7 16 Project7