Wednesday, February 27, 2013

Function

Functions

1. To display use start (No values are move in function call )

malarkey main()
{
subdue display( neutralise);
}
neutralize display()
{
printf(Hello);
}

2. To find the sum of two metrical composition using function.

empty main()
{
void sum (int a, int b); /*function prototype*/
sum(2, 3);
}

void sum (int a, int b)
{
int c;
c=a+b;
printf(n nerve center = %d,c);
}

3. Functions with no arguments and no return values

void main()
{
void sum(void); /*function prototype*/
sum();
}

void sum(void)
{
int a, b, c;

a = 5;
b = 8;
c = a+b;

printf(n conglutination of numbers: %d, c);}

4. Functions with arguments and no return values

void main()
{
void sum(int a, int b);
int a, b;

a = 5;
b = 8;

sum(a, b);
}

void sum(int a, int b)
{
int c;

c = a + b;

printf(n Sum of numbers: %d, c);
}

5. Functions with arguments and one return values.

void main()
{
int sum(int a, int b);
int a, b, c;

a = 5;
b = 8;

c = sum(a, b);
printf(n Sum of numbers: %d, c);
}

int sum(int a, int b)
{
int t;

t = a+b;

return (t);
}
6. Functions with no arguments but return a value.

Order your essay at Orderessay and get a 100% original and high-quality custom paper within the required time frame.



void main()
{
int sum(void);
int c;

c = sum();

printf(n Sum of numbers: %d, c);
}

int sum(void)
{
int a, b, t;

a = 5;
b = 8;

t = a+b;

return (t);
}

7. Functions that return ternary values.

void main()
{
void operation(int a, int b, int *sum, int *diff);
int a, b, c, d;

a = 5;
b = 8;

operation(a, b, &c, &d);

printf(n Sum of numbers: %d, c);

printf(n Difference of numbers : % d, d);
}

void operation(int a, int b, int *sum, int *diff)
{
*sum = a + b;

*diff = a b;
}

Nesting of Functions (Function with a function)

void main()
{
void sum(void);

sum();
}
void sum(void)
{
void display(int c);
int a, b, c;

a = 5;
b = 8;

c = a+b;

display(c); /*Nesting of Functions*/
}
void display(int c)
{...If you fate to get a full essay, order it on our website: Orderessay



If you want to get a full essay, wisit our page: write my essay .

No comments:

Post a Comment