Aptitude (12) ASP.NET (2) Automata (4) Browser (1) C (5) C# (1) C++ (10) Code (3) CSS (1) Data Structure (1) DATABASE (3) HTML (1) java (43) JSP (1) math (1) MySql (8) other (6) php (3) Servlet (3)

Saturday, 21 January 2012

Default argument

In C++ we can call functions without specifying its all arguments.
  • A default argument is checked for type at the time of  declaration.
  • Default argument evaluated at the time of Call.
  • We must add default value of argument from Right to Left.
                     e.g
          int function(int a,int b=9,int c=3)                 //Valid
          int function(int a,int b=7,int c)                    //Invalid
          int function(int a=4,int b=9,int c)               //Invalid
          int function(int a=6,int b=9,int c=3)           //Valid



No comments:

Post a Comment