How does the compiler handle the default value of a function argument if it's not provided in a function call?

  • It assigns a random value
  • It assigns a value of 0
  • It assigns the default value specified in the function declaration
  • It raises a compilation error
It assigns the default value specified in the function declaration. When a function argument with a default value is not provided in a function call, the compiler assigns the value specified in the function's declaration. This behavior ensures that functions can be called with missing arguments.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *