return type? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

return type?

what is the use of return type?may be is to determin the type of the value the fuction returns?but why does main fuction which is able to do almost everything has a return type of intenger?

17th Jan 2019, 1:59 PM
HZCK_Mi Sa Pon
HZCK_Mi Sa Pon - avatar
2 Réponses
+ 5
It is indeed to determine the type of the value the function returns. In the case of main(), the returned value is an error code, with 0 meaning no error, and any other value meaning an error of your choosing. If for example you have launched your program with another program, that other program can do stuff differently depending on that returned value.
17th Jan 2019, 2:28 PM
Zen
Zen - avatar
0
Rewa Mathur ,so in another word,could i consider the fuchion in other fuctions as a variable that is set in the type that determined by 「return type」?
17th Jan 2019, 2:41 PM
HZCK_Mi Sa Pon
HZCK_Mi Sa Pon - avatar