+ 1

how do parameters work in methods? c#

i don’t understand why when you call a method, the parameter is different from the one that you put in first. (sorry for my bad English, English is not my first language) thank you!

20th Mar 2019, 10:53 PM
Julia García
Julia García - avatar
3 odpowiedzi
+ 7
//our method. mySum(int i, int j){doSomthing;} //we call and pass arguments. mySum(10,20); //arguments passed to the methods parameters. mySum(int i holds 10, int j holds 20){doSomthing;}
21st Mar 2019, 12:12 AM
D_Stark
D_Stark - avatar
0
Can you give an example?
20th Mar 2019, 11:55 PM
[No Name]
0
sure. like having this method static int[] TotalizaMediciones(int[] arregloMediciones) and then calling it like this int[] totalesRango = TotalizaMediciones(mediciones); why do i use "mediciones" instead of "arregloMediciones" when i'm calling the method?
21st Mar 2019, 12:03 AM
Julia García
Julia García - avatar