answersLogoWhite

0

Its way of passing arguments to a function.In this method the value of actual arguments(the arguments in the function call)remains unchanged. changes that we make are effected only to the formal arguments.

eg.

#include void modify(int,int);// function prototype. this is given to make the compiler aware that there is a function modify. if we didnt do this a error will be shown. otherwise the function body should be written before the function call

main()

{

int a,b;

printf("enter two numbers");

scanf("%d %d",&a,&b);

modify(a,b);// function call the parameters a and b are actual arguments.

printf(" a and b in the main %d and %d",a,b);

}

void modify(int a,int b)// function header the parameters no1 and no2 are called as formal arguments.

{

a=a*3;

b=b*3;

printf(" a and b in function %d and %d",a,b

}

output:enter two numbers

3

2

a and b in function 9 and 6

a and b in the main 3 and 2.

this is a program to multiply 3 to the numbers given by the user . here we use function and the arguments are passed by call by value method.here the value of the formal arguments are altered withinthe function but no change happens to the actual arguments . the values in the main does change even after the function call.

User Avatar

Wiki User

14y ago

What else can I help you with?

Related Questions

What is the difference between call by name and call by value in programming languages?

In programming languages, call by value passes the value of a variable to a function, while call by name passes the name of the variable. Call by value evaluates the value before passing it, while call by name evaluates the value when it is used in the function.


What is the value c after c--3 in C programming?

Nothing, c--3 is syntactical error.


What programming language was Call of Duty 5 written in?

C++


What is the difference between call by value and call by name in programming languages?

In call by value, the value of the argument is passed to the function, while in call by name, the expression for the argument is passed and evaluated each time it is used in the function.


Why c is call structured programming?

Because you can use programming structures, namely: sequence, selection (if, switch) and repetition (while, for, do-while)


How does the compiler differentiate the statement and function in C programming?

statement should not return a value but function returns a value


How do you convert numeric value into alpha value in c plus plus programming language?

use the _itoa function


How was call of duty created and what programming language used?

im not 100% sure, but i think it is c++.


How do you combine call by value and call by reference programs in c?

Very easily: there is no call-by-reference in C.


Call by value in C?

Yes.


What is 'variable' in C programming?

It's a part of the program's data, which has a name,type and value.


What does c plus plus use call by value or call by reference?

When we call a function in C++ by passing the values as arguments, it is called call by value. e.g #include<iostream.h> #include<conio.h> int add(int,int); int main() { int a,b,c; cout<<"Enter numbers."; cin>>a>>b; c=add(a,b); cout<<"Sum : "<<c; return 0; } int add(int a,int b) { int c; c=a+b; return c; }