+ 2
program
#include<stdio.h> int add (void); void main() { int s; s=add(); printf("sum is %d",s); getch(); } int add() { int a,b,c; printf("enter two numbers"); scanf("%d %d",&a,&b); c=a+b; return(c); } what is the error in this?
4 ответов
0
clrscr() function definition is available in conio.h header file so you need to include it .
Except that nothing wrong in logic
0
when i removed conio.h &clrscr then still error is coming . what should i do?
0
Change return type of main to int.
this error is only because of compilers you are working.
In many compilers default return type must be int .
If you execute same code in "Turbo C " you need not get any errors.
Also getch() function also available in conio.h
header file.
Hope you understand.
0
thanks