Hi I have a general query. I just started learning C. But have a problem. I wrote a simple program:- main() { int a,b,c; a=10; b=20; c=a+b; printf("%d",c); } But enable to give output. Always a massage come: Function should return a value Why?
replace main with void main() ... yaa a function should return a value.. and when it doesn't, its return type is void
#include<stdio.h> // standard input output header file #include<conio.h> main() { int a,b,c; clrscr(); a=10; b=20; c=a+b; printf("%d",c); getch(); } Try this, include files it will run, but you too not doing mistake dude. But if you again face this problem then use void because if a function not returning a value then always use void function_name()
hi, You should write void main() instead of main() when you are not returning any value. Your error would be solved by this.