Default values for a function are specified when function is declared. - Functions

Q.  Default values for a function are specified when ____ .
- Published on 17 Jul 15

a. function is defined
b. function is declared
c. Both a and b
d. None of these

ANSWER: function is declared
 

    Discussion

  • Girish   -Posted on 28 Aug 18
    wrong answer,
    answer is C
    when the function is defined before main then we can assign the default values
  • Nihal   -Posted on 09 Oct 15
    Default values for a function are specified when function is declared.
    Example:
    void defFunction(int x=10 , int y=20)
    {
    // Implementation here.
    }
    if arguments are not passed while invoking a function then, the default value passed to arguments are used.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)