Function:
Types:
1. Call By Value
2. Call By Reference
Basic Requirement to learn this code:
1.Function
2.Use of pointer in function
3.Swapping of two number
Example:1: (Call By Reference)
#include<stdio.h>
void swap(int*, int*);
main()
{
int a,b;
a=5;b=10;
swap(&a,&b);
printf("after swapping a=%d,b=%d",a,b);
}
void swap(int *x,int *y)
{
int t;
t=*x;
*x=*y;
*y=t;
}
Note: All Codes are written in DEV-C++.
Types:
1. Call By Value
2. Call By Reference
Basic Requirement to learn this code:
1.Function
2.Use of pointer in function
3.Swapping of two number
Example:1: (Call By Reference)
#include<stdio.h>
void swap(int*, int*);
main()
{
int a,b;
a=5;b=10;
swap(&a,&b);
printf("after swapping a=%d,b=%d",a,b);
}
void swap(int *x,int *y)
{
int t;
t=*x;
*x=*y;
*y=t;
}
Note: All Codes are written in DEV-C++.
Comments
Post a Comment