What does “ = 0” here mean?

前端 未结 3 675
南方客
南方客 2021-01-25 14:54
int foo (int a , int b = 0)

I just read this code. I don\'t understand what \" = 0\" means?

I would also like to know why int foo (int a

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-25 15:43

    It sets the default value for the parameter "b" to the function foo, so that the call foo(345) is equivalent to the call foo(345, 0)

提交回复
热议问题