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 static identifier?
Why c is called object oriented language?
Is it valid to address one element beyond the end of an array?
What is the difference between char array and char pointer?
What is the purpose of macro in C language?
Explain what does the format %10.2 mean when included in a printf statement?
What is malloc return c?
count = 0; for (i = 1;i < = 10; i++);count = count + i; Value of count after execution of the above statements will be a) 0 b) 11 c) 55 d) array
How can a string be converted to a number?
Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix
Why use int main instead of void main?
What is the right type to use for boolean values in c? Is there a standard type?
Can you please explain the difference between malloc() and calloc() function?
Explain what’s a signal? Explain what do I use signals for?
Are the variables argc and argv are local to main?