write a program to swap Two numbers without using temp variable.

Answer Posted / ajith c.k

#include"stdio.h"
int swap(int *,int*);
int main()
{
int a,b;
printf("enter two number");
scanf("%d%d",&a,&b);
swap(&a,&b);
printf("%d\t%d",a,b);
return ;
}
int swap(int *s,int *q)
{

if(*s==*q)
return;
*s^=*q;
*q^=*s;
*s^=*q;
return ;
}

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why main function is special give two reasons?

936


What is c token?

597


c program to compute AREA under integral

1797


Given a valid 24 hour format time find the combination of the value and write a program ,do not hard the value and if any other inputs provided should work with the logic implemented Input: 11:30 Output: 13:10 Input: 18:25 Output: 21:58

1111


What is string function in c?

529






What is typedef example?

607


What is the concatenation operator?

599


What is the data segment that is followed by c?

600


Explain the bubble sort algorithm.

632


How variables are declared in c?

563


What is default value of global variable in c?

552


What is malloc() function?

628


How many identifiers are there in c?

571


I just typed in this program, and it is acting strangely. Can you see anything wrong with it?

548


What does %2f mean in c?

670