Parameter Passing

Bhaskara
Posted by Bhaskara under C# category on | Points: 40 | Views : 1439
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication
{
class Program
{

static void Main(string[] args)
{
int i=0;
Console.WriteLine("The value of i before call", i);
f1(i);
Console.WriteLine("The value of i after call", i);
}

static void f1(int k)
{
k = k + 10;
}
}
}


Output
The value of i before call 0
The value of i after call 0


The parameter used for writing the function is called formal parameter
The argument used for calling the function is called actual parameter
The actual and formal parmeter have the same name
The value of i before and after the function call will be same

Comments or Responses

Login to post response