-c- Return type | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

-c- Return type

what is the point of the usage of reutrun sonuc;?? #include <stdio.h> int fak(int sayi) { int sonuc=1; for(int i=0;i<sayi;i++){ sonuc=sonuc*(i+1); } return sonuc; /// } int main(){ printf("%d",fak(5)); }

2nd May 2020, 1:24 PM
Abc def
Abc def - avatar
2 Answers
0
When you make a call to method with some return type then it must return some data of same type. In your case, the return sonuc just replaces fak(5) by returning a value so that it can be printed.
2nd May 2020, 1:58 PM
Avinesh
Avinesh - avatar
0
and what is "come back" in your example? if you already understood what is return value that doesn't mean that everyone must understand it now, right? I do not understand what is return value also, so I will be happy to get the clear explanation ....
2nd May 2020, 6:59 PM
Yohonon Makunin
Yohonon Makunin - avatar