I want to make a function that has parameters like here
void example(int x, int y, int z);
but I dont have to put z in there like this example(34, 21); is that possible in C++?
I want to make a function that has parameters like here
void example(int x, int y, int z);
but I dont have to put z in there like this example(34, 21); is that possible in C++?
You basically have two options
void example(int x, int y, int z)
and
void example(int x, int y)
void example(int x, int y, int z = 0)
The way to use undefined amount of parameters is to use ellipsis. For further read i recomend to look through https://en.cppreference.com/w/cpp/language/variadic_arguments To implement it just google how to use c++ ellipsis and thats it!