C and C++ Programs
It Contains C And C++ programs that are useful for students it includes C programs for data structures
Call By Value in C
/* Program for inerchanging two numbers demonstrating Call By Value in C */
#include< stdio.h>
#include< conio.h>
void swap(int *,int *);
void main()
{
int x,y;
x=15;y=20;
clrscr();
printf("x=%d,y=%d\n",x,y);
swap(&x;,&y;);
//printf("\n%x %x",&x;,&y;);
printf("\n after interchanging x=%d,y=%d\n",x,y);
getch();
}
void swap(int *u,int *v)
{
int temp;
temp=*u;
*u=*v;
*v=temp;
return;
}
#include< stdio.h>
#include< conio.h>
void swap(int *,int *);
void main()
{
int x,y;
x=15;y=20;
clrscr();
printf("x=%d,y=%d\n",x,y);
swap(&x;,&y;);
//printf("\n%x %x",&x;,&y;);
printf("\n after interchanging x=%d,y=%d\n",x,y);
getch();
}
void swap(int *u,int *v)
{
int temp;
temp=*u;
*u=*v;
*v=temp;
return;
}
Related Articles
Comments
Be the first to leave a comment!
About the Author
From Our Partners
People in Pictures
Top Geek Articles
|
Celebrities on the Phone
Cell phones are to celebrities like bats are to baseball: no one runs too far without them.
|
|
Why every guy should buy their girlfriend Wii Fit.
Gratuitous...
|
|
Hot Geeks -- The Sexiest Geeky Girls
These girls are gorgeous AND they'll play Warcraft with you. Doesn't get much better than that.
|




