Methods | SoloLearn: Learn to code for FREE!

+3

Methods

int Sqr(int x) { int result = x*x; return result; } when we declare this method shouldn't we also add int result in the parameters if not then why ???

9/18/2017 9:16:24 AM

vipul jain

1 Answer

New Answer

+11

Actually parameters of function simply mean the inputs which a function takes. As we can see the only input required by the function is only x so it is a parameter. Whereas result is a variable inside function to facilitate calculation.