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
Explain 'bus error'?
What are the benefits of c language?
Write the Program to reverse a string using pointers.
What are register variables? What are the advantage of using register variables?
Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant
Explain the properties of union.
What is the use of getchar functions?
What is the use of ?: Operator?
How can I trap or ignore keyboard interrupts like control-c?
What is d scanf?
What is s in c?
What are the advantages of using new operator as compared to the function malloc ()?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
What is the auto keyword good for?
What is call by value in c?