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 structure data type in c?
c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above
How are 16- and 32-bit numbers stored?
What is output redirection?
What are terms in math?
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
what is different between auto and local static? why should we use local static?
Is c dynamically typed?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
What is the value of c?
How to write a multi-statement macro?
void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply
What are data types in c language?
I heard that you have to include stdio.h before calling printf. Why?
is it possible to create your own header files?