Wednesday, 30 January 2013

Function in C sharp


By on 23:04

Functions in C sharp(c#):-Function is a code which perform a specific task.Function are generally divided into 2 parts namely Returning function and non-returning function.

1)Non-Returning Function:-Non-Returning function are those function which are not return a single value.Non-Returning Function are further divided in to two parts namely With Argument and Without Argument.

Example of With Argument:-


void add(int a,int b);

int a,b;
a=Console.WL();
b=Console.WL();
add(a,b);
}
static void add(int a,int b)
{
int c;
c=a+b;
Console.WL(+c);
}}

Example Without Argument:-


void add()
{
add();
}
static void add(int a,int b)
{
int a,b,c;
a=Console.WL();
b=Console.WL();

c=a+b;
Console.WL(+c);
}}


2)Returning Function:-Returning function are those function which are return values.Returning Function are further divided in to two parts namely With Argument and Without Argument as like as Non-Returning function.



If you have any query then leave your comments and don't forgot to follow me on Google+,Facebook,Twitter.

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...