Constant argument, C/C++ Programming

Define Constant argument:

The argument can be a constant argument The constant variable cannot be changed inside the function definition when the argument is declared as constant.

 

void f_const(int x, const int y);

void main( )

{int a10, b=20,c;

c =f_const(a, b); //The value of c is 30

}

int f_ref(int x, const int y)

{ //y=20; // Is invalid because y is declared as constant variable. return (x+y);

}

 

void f_const(int x, const int y=100);

void main( )

{int a=200, b,c;

c =f_const(a); //The value of c is 300

}

int f_const(int x, const int y)

{ //y=20; // Is invalid because y is declared as constant variable. return (x+y);

}

Posted Date: 9/20/2012 7:49:05 AM | Location : United States







Related Discussions:- Constant argument, Assignment Help, Ask Question on Constant argument, Get Answer, Expert's Help, Constant argument Discussions

Write discussion on Constant argument
Your posts are moderated
Related Questions
Add a function for saving the text stored in an array to a file. Your program must check whether or not the output file already exists, and if it does, your program must ask the us

Explain redirection in c++

A parking garage charges a $2.00 minimum fee to park for up to three hours and an additional $0.50 per hour for each hour or part thereof over three hours. The maximum charge for a

For this program, you are going to modify your previous program (program 3) so that it will now have a menu to see if the user wants to read the input from a file or interactively.


how to create a shopping cart

write a c program to compute a padovan string

S y m b o li c c o n s t a n t : c on s t m a x = 1 0 0 ; T h e d e f a u l t d a t a t y p e w i l l b e i n t e

derivations 1. Regardless of the type of derivation, private members are inherited by the derived class, but cannot be accessed by the new member function of the derived class,

I need to create a connection to FIFA Ultimate Team 14, I want to utilize C++ specifically for the reason that that is the language I have the most experience in. There are a co