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
The ability to verify at run time the type of an object by using the typed operator or the dynamic_cast operator.

write a C program for padovan string for a natural number

At 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 with thes

C program to print R diagonal triangle: #define rows 3 #define cols 3 void main() {                 int i=0,j=0;                 int arr[rows][cols];


Project Description: Project Description: I am seeking a programmer who will be able to design some software that will allow the user to: 1) Repeatedly monitor Nike twitter a

Program to design text styles: Write a C program to design different text style char *fname[] = { "DEFAULT font",                                   "TRIPLEX font",


(a) Write a recursive procedure (digits n) that computes the number of digits in the integer n using a linear recursive process. For example, (digits 42) should return 2 and (digit

i need a program for finding the last fibonacci number