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

How does c++ help with the tradeoff of security vs.usability, A: In C, enca...

A: In C, encapsulation was completed by making things static in a compilation unit or module. It prevented another module from accessing the static stuff. (Incidentally, now static

AREA UNDER CURVE, Write a program to find the area under the curve y = f(x)...

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 between two points can b

What is your reaction to following line of code? , Q-What is your reaction ...

Q-What is your reaction to following line of code?               delete this; A: This is not a good programming Practice. A good programmer will insist that you must absolute

E^x, Write a program to calculate e^x using the formula: e^x = 1 + x/1! + ...

Write a program to calculate e^x using the formula: e^x = 1 + x/1! + x^2/2! + x^3/3! + ...... Allow the user to enter the integer number x, then do the calculation in a loop (for

Draw pie chart in c++ program, Draw pie chart in c++ program: int main...

Draw pie chart in c++ program: int main() {                 char cmd;                   cout                 cout                 cmd = toupper(getch());

Gene program, Many human diseases could be controlled by the knowledge of t...

Many human diseases could be controlled by the knowledge of the gene’s structure and pattern. The human gene could be represented by four nucleotides. Each nucleotide is represente

Programing, #question. write a program number to alphabet in c++..

#question. write a program number to alphabet in c++..

C++, #questAt a shop of marbles, packs of marbles are prepared. Packets are...

#questAt a shop of marbles, packs of marbles are prepared. Packets are named A, B, C, D, E …….. All packets are kept in a VERTICAL SHELF in random order. Any numbers of packets wit

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