Constant argument, C/C++ Programming

Assignment Help:

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);

}


Related Discussions:- Constant argument

What does odbc do in context with php, What does ODBC do in context with PH...

What does ODBC do in context with PHP? PHP supports many databases such as dBase, Microsoft SQL Server, Oracle, etc. however, it also supports databases such as filePro, FrontB

C++ project, project on business management

project on business management

#titlethe Average Temperature in Paradise.., Writing and compiling a progra...

Writing and compiling a program from a given Use Case definition. Follow the Average Temperature in Paradise

Array-based Lists and Array-based Queues, Objectives: The objective of this...

Objectives: The objective of this assignment is to use C++ to queue students into an array-based queue for BCS registration. Students have the option of taking five different cours

Program of cascading, Program of cascading: class vector{          ...

Program of cascading: class vector{                 private :                 int v[3];                   public:                 friend istream & operator >> (

Program to calculate the n factorial, Debug the following program to calcul...

Debug the following program to calculate N! #include using namespace std; main() {             int N, factorial=1;             cout             cin >> N;

Html, world wide web commands

world wide web commands

Program, Write a program to find the area under the curve y = f(x) between ...

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve betw

Source code, I hv an assignment to do, I almost done. But i cant find whats...

I hv an assignment to do, I almost done. But i cant find whats wrong- my code is to make a simple calculator using function''s all 4 patterns. I did like this- #include int add

.Change to palindrome, A palindrome is a string that reads the same from bo...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

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