Hunali
Hunali

Reputation: 277

In how many different ways can I call a function

In how many ways can I call this function, I found this question in one book and I was like 1 but I'm not sure, I think I can call it just once because, it has 3 integer parameters so that's the only way, I guess. The given answers wear (1, 2, 3 or 4) ways to call the Function.

int Volume (int x, int y=0, int z=3){ return x+y+z;}

What's the correct answer?

Upvotes: 0

Views: 72

Answers (1)

Akash Baskaran
Akash Baskaran

Reputation: 66

Three ways.

Example :

volume(3) //x = 3, y = 0, z = 3

volume(3,4) // x = 3, y = 4, z = 3

volume(3,4,5) // x = 3, y = 4, z = 5

Upvotes: 4

Related Questions