Consider a function declared with default arguments. If we provide a lesser number of arguments than expected when calling the function, how are the provided arguments matched?

  • Arguments are matched based on data types.
  • Arguments are matched from left to right.
  • Arguments are matched from right to left.
  • Compiler throws an error.
When calling a function with default arguments, the provided arguments are matched from left to right. If you provide fewer arguments, the remaining ones are matched with their corresponding default values, if any.
Add your answer
Loading...

Leave a comment

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