cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
Function Header?
Function Header?
Sep 24, 2015 at 7:45am UTC
Dkob1
(227)
How is a function header coded when the function call should allow a mix of default and required arguments?
Give an example of a calls using zero, one, and two default arguments, with one required argument; and the header of the function called.
Would this be okay?
int mul(int ra, int rb=3, int rc=4);
Sep 24, 2015 at 10:41am UTC
keskiverto
(10402)
Give an example of a calls using zero, one, and two default arguments
Can you write the example, where
mul
is called with different number of arguments?
Sep 24, 2015 at 6:37pm UTC
Dkob1
(227)
Didn't understand what you meant
Sep 24, 2015 at 8:19pm UTC
AbstractionAnon
(6954)
Would this be okay?
int
mul (
int
ra,
int
rb=3,
int
rc=4);
Yes, that is an acceptable function declaration for a function that takes 1 required argument and 2 optional arguments with default values. Required arguments must be specified before any default arguments.
Topic archived. No new replies allowed.