Prashant | Wed, 10 Jun, 2020 | 150
The standard statements are :-
int main()
void main()
Example ;-
#include
void main()
{
clrscr();
add(5,4);
getch();
}
int add(int a,int b)
{
int c;
c=a+b;
printf("Output: %d",c);
return 0;
}
now see the guys when you use the function having some parameters than time return some a and b values so now use int main function
if use void add(int a,int b) system throw the error. so i use int add(int a,int b)
Note :-
1. int main() is preferred over void main(), as per standards, and most new compilers supports int main() rather than void main().
2. int main() can help to return the error code if your program fails due to some error.
(Pre exception handling days, now you may use exception handling to handle issues,
perhaps that's the reason in java we go as public static void main () )
1. Introduction And Getting Started With C
3. Why We Should Use C Language
4. Applications Of C Programming
5. Basic Rules For Writting C Program
8. Tokens In C
9. Difference Between Int Main And Void Main
11. Variables In C
13. Difference Between Local And Global Variable
14. Difference Bwtween Auto / Extern / Static Variable
15. Constant In C
16. How To Access Global Variable Using Extern Keyword In C
17. Exit And Return Staterment In C
18. Print Float Value Upto N Decimals In C Programming
19. How To Print Multiline Message Using Single Printf In C Programming ?
20. What Value Returned By Scanf Function In C Language ?
21. What Value Is Returned By Printf And Scanf In C