C# Call By Value1 min read

This is passing parameters by Value. These value-type parameters in C# copy the actual parameters to the function (known as formal parameters) rather than referencing it.

Whenever a method is called by passing value, a new storage location is created for each value parameter. The copies of these values are stored, hence the changes made in the formal parameter have no effect on the actual argument.


Example: C# call by value

Output:

As you can see the value of a and b is not changed, even though the two value are swapped inside a function.


MORE

Keith Number Program in C

In this tutorial, we will write a Keith number in C. It is one of the most asked questions in an interview. Before that, you …
Read More

Keith Number Program in C++

In this tutorial, we will write a Keith number in C++. It is one of the most asked questions in an interview. Before that, you …
Read More

Singly linked list Program C++

In this tutorial, we will write a C++ program to implement singly linked list. In this program, we will create a separate function for each …
Read More

Fascinating Number Program in C

In this tutorial, we will write a C program to check whether the given number is a Fascinating number or not. You may go through …
Read More

Peterson Number in C

In this tutorial, we will learn about the Peterson number and check if the number is Peterson or not in C. What is Peterson Number? …
Read More

Peterson Number in C++

In this tutorial, we will learn about the Peterson number and write a C++ program to check if the given number is a Peterson number …
Read More