Explain default arguments, C/C++ Programming

Assignment Help:

Default Arguments

A default argument is a value that is automatically assigned to a formal variable, if the actual argument from the function call is omitted.

e.g.

void drawbox( int x1=1, int y1=1, int x2=25, int y2=80,

 int color=7);                                                // Prototype

 

  void main ( void )

 {

 drawbox(10,1,25,80,14); // parameters passed

 drawbox();   // uses default arguments        

}     

void drawbox( int x1, int y1, int x2, int y2,

          int color)

{

// Body of the function

                   }

 Function drawbox() draws a box around the edges of the coordinates passed as parameters. If these parameters are omitted, then the default values, as given in the declaration are passed.

 


Related Discussions:- Explain default arguments

Mat lab programming, MAT LAB programming Project Description: Just fo...

MAT LAB programming Project Description: Just for who are PROFESSIONAL IN MATLAB i have simulation and i would like to simulate the equation in ,and test the all simulatio

Calculate and display the marks and grade for each student, In this assignm...

In this assignment you are required to develop a program that allows the creation, viewing and storage of information about ITECH7603 Students. In order to complete the task you ha

C program to demonstrate call by reference, C program to demonstrate call b...

C program to demonstrate call by reference: void disp(int *,int*,int*,int*); void main() {                 int a=2,b=3, sum,mul;                 printf("Enter 1st n

Example of structure, Example of structure: struct item {       ...

Example of structure: struct item {                 int element;                 node_ptr next; }; typedef node_ptr stack; stack create(void) {

Left in the lurch, Hey vrcoder I have got similar way but the game builder ...

Hey vrcoder I have got similar way but the game builder has sent me the game unfinished and left. I saw it on a link on line but they have wiped the old message with the link in it

Write short note on classes in c++, Introduction to Classes Object-orie...

Introduction to Classes Object-oriented programming (OOP) is a conceptual approach to design programs. It can be executed in many languages, whether they directly support OOP c

Create complex number using constructor , Create Complex number using const...

Create Complex number using constructor: class complex                                 {                                                   private:

Define the c preprocessor, Define the C Preprocessor? Preprocessor' is ...

Define the C Preprocessor? Preprocessor' is a translation stage that is applied to your source code before the compiler proper gets its hands on it usually the preprocessor per

Decode the code, Smugglers are becoming very smart day by day. Now they hav...

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd