Why we use int out of main function?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why we use int out of main function??

int main() { statements } here why we use int before main function....

28th Jun 2019, 4:54 PM
Sahil P Gaonkar
Sahil P Gaonkar - avatar
3 Answers
+ 9
int means that the function returns an integer: int add(int a, int b) { return a + b; // <<== return value of the function is an integer }
28th Jun 2019, 5:10 PM
Muaz Ahmad
Muaz Ahmad - avatar
+ 2
It offers a way to tell, how the program terminated, often 0 means that the program ran well and terminated with no errors. But 1 means that the program was terminated with errors. This is used in programs, such as the command prompt, it is very useful, when you want to run the command prompt from a program, when it returns 1 or 0, telling, whether executing a command caused problems or not.
28th Jun 2019, 5:04 PM
Seb TheS
Seb TheS - avatar
0
Thank you..
10th Sep 2019, 10:31 AM
Sahil P Gaonkar
Sahil P Gaonkar - avatar