Computer Science, asked by shivikaoberoi06, 6 months ago

which argument can be skipped from function call​

Answers

Answered by himanshu2003sahrawat
18

Answer:

Default Arguments

Explanation:

Answered by ankhidassarma9
1

Answer:

Default arguments can be skipped from function call​.

Explanation:

  • A function is called inside a program whenever and wherever it is required to call a function.
  • we need to call a function by its name followed by parentheses inside which we write the argument's values or references.
  • During a function call, the mandatory argument is a keyword argument.
  • A function can be called without specifying all its arguments if the function declaration provides default values for those arguments that are not specified.
  • For example:  

                             #include <iostream>

                              using namespace std;

                              void repchar(char='*' , int=45);

                               int main

                               {   repchar ();

                                 rechar('=');

                                return 0;

                              }

                     void repchar(char ch, int n)

                    {

                for(int j=0;j<n; j++)

              cout << ch;

              }

  • In this program the function repchar() takes two arguments. it is called two time from main(), first time with no arguments and second time with one argument.
  • The program will Run as the called function provides default arguments , which will be used if the calling program doesn't supply them.

Similar questions