0

Hi anyone can explain What's return's operation here?

Int sqr (x) { Result=x*x; Return x; }

17th Jun 2020, 12:37 PM
Mohamed Waseem
Mohamed Waseem - avatar
1 Odpowiedź
+ 2
It will return the value of x*x.. BTW code is logically wrong, coz this will return the value you passed as parameter.. It should be like ‘return result;' .. Return keyword passes the value or can be used without value while using void data type, when return is executed the control of program jumps back to the point from where the particular function was called and starts executing next line of that code..
17th Jun 2020, 12:54 PM
Alaska
Alaska - avatar