+ 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?

20th Jun 2020, 4:16 PM
unnati priya
unnati priya - avatar
4 ответов
0
clrscr() function definition is available in conio.h header file so you need to include it . Except that nothing wrong in logic
20th Jun 2020, 4:28 PM
uday kiran
uday kiran - avatar
0
when i removed conio.h &clrscr then still error is coming . what should i do?
21st Jun 2020, 8:00 AM
unnati priya
unnati priya - avatar
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.
21st Jun 2020, 9:31 AM
uday kiran
uday kiran - avatar
0
thanks
21st Jun 2020, 2:25 PM
unnati priya
unnati priya - avatar