0
Can anyone explain me how does this code works?
static void Main(string[] args) { int a = 4; int b = 5; int c = 2; Console.WriteLine(Func(c, b)); } static int Func(int a = 3, int b = 7, int c = 6) { return a + b * c; }
6 Answers
+ 1
Func takes 3 arguments. If some is not passed to function then their values are a=3 b=7 c=6.
In main you pass only 2 arguments then Func has: a=2,b=5,c=6.
+ 1
dado dad Yes.
0
Bartosz Pieszko, so variable "a" takes value 2 from variable "c" then argument "c" takes 6 value from optional parameter "c"?
0
Thank you very much!
0
32?
0
yes