write a program in C to swap two variables
Answer Posted / priyamurugan
#include<stdio.h>
#include<conio.h>
main()
{
int a,b;
printf("\n BEFORE SWAPPING THE NOS");
printf("\n enter the a, b values");
scanf("%d %d",&a,&b);
swap(&a,&b);
printf("\n AFTER SWAPPING THE NOS");
printf("\n a=%d",a);
printf("\n b=%d",b);
getch();
}
swap(int *x,int *y)
{
int t;
t=*x;
*x=*y;
*y=t;
return();
}
| Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
What is a null string in c?
What is function in c with example?
What is the difference between c &c++?
What is the best style for code layout in c?
Can one function call another?
Explain how do you search data in a data file using random access method?
How a string is stored in c?
application attempts to perform an operation?
I need previous papers of CSC.......plz help out by posting them.......
ATM machine and railway reservation class/object diagram
How many keywords are there in c?
How can I check whether a file exists? I want to warn the user if a requested input file is missing.
Can 'this' pointer by used in the constructor?
Why is c so powerful?
1.int a=10; 2.int b=20; 3. //write here 4.b=30; Write code at line 3 so that when the value of b is changed variable a should automatically change with same value as b. 5.