More explanation about default and constant arguments
can you please give differences between default and constant arguments
Collapse
X
-
Tags: None
-
If you fail to supply a value for an argument, a default value can be provided.
A constant argument means the function will not change the value of the argument. -
Are you asking about command line arguments?
Unless you're doing something tricky, the function prototype will coerce you into supplying all the function arguments -- there cannot be such a thing as default function arguments. However, there are tricky ways to get around this.
Are you referring to the const keyword when you say "constant arguments"? You will get a compiler error if you try to change the value of a function argument that is declared const.
C uses call-by-value. This means that changes made to an argument inside a function are not seen by the code that called the function. (There are tricky ways to get around this too.)Comment
-
There are default function argumenta in C++ but not in C.
That is to say, default VALUES for function arguments.Comment
Comment