Is it possible to provide default values to function arguments in C? For example:
void display(int a, int b = 10) {
// do something
}
main() {
display(1);
display(1,2); // override default value
}
Visual Studio 2008, complains that there is a syntax error in void display(int a, int b = 10)
. If this is not legal in C, what is the alternative?
Default parameters is a C++ feature.
C has no default parameters.