The answer is no, you can’t. You could get the behaviour you want using overloads:
void f(int a, int b, int c);
inline void f(int a, int b) { f(a,b,b); }
inline void f(int a) { f(a,a,a); }
As for the last question, C doesn’t allow default parameters at all.
More Related Contents:
- C++ Creating a parking charge
- Why can’t we pass arrays to function by value?
- Is there a way to pass auto as an argument in C++?
- how can i increase the speed of my C++ calculation [closed]
- Optimization code for a debug function (c++11 with templates) [closed]
- Possibilities to quit a function
- Why pass by const reference instead of by value?
- Is there a difference between foo(void) and foo() in C++ or C?
- Overload a C++ function according to the return value
- How to convert a lambda to an std::function using templates
- Meaning of = delete after function declaration
- Why is std::function not equality comparable?
- Which is more efficient: Return a value vs. Pass by reference?
- Why does C++ allow unnamed function parameters?
- C++ correct way to return pointer to array from function
- Inferring the call signature of a lambda or arbitrary callable for “make_function”
- Declare variables at top of function or in separate scopes?
- Is there any way a C/C++ program can crash before main()?
- Why I can access member functions even after the object was deleted?
- Calling a function in main
- C++ Function Callbacks: Cannot convert from a member function to a function signature
- About Pointers To Functions in function declarations
- Why the initializer of std::function has to be CopyConstructible?
- Why am I able to make a function call using an invalid class pointer
- Function returning array but main showing garbage [duplicate]
- How does the friend keyword (Class/Function) break encapsulation in C++?
- How to properly use system() to execute a command in C++?
- What does *& mean in a function parameter
- Boost.Python: Wrap functions to release the GIL
- Differences of using “const cv::Mat &”, “cv::Mat &”, “cv::Mat” or “const cv::Mat” as function parameters?