a C prog to swap 2 no.s without using variables just an
array?

Answer Posted / jaspreet singh

void main()
{
int a[2]={20,10};
a[0]=a[0]^a[1];
a[1]=a[0]^a[1];
a[0]=a[0]^a[1];
printf("a=%d,b=%d",a[0],a[1])
getch();
}

Is This Answer Correct ?    7 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is the memory area not included in C program? give the reason

1497


What are runtime error?

619


Differentiate between null and void pointers.

626


Is register a keyword in c?

629


What is the difference between new and malloc functions?

572






What is time complexity c?

560


Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.

1718


Is file a keyword in c?

495


Is the exit() function same as the return statement? Explain.

655


What is a macro?

652


Can you please explain the difference between strcpy() and memcpy() function?

593


What is extern storage class in c?

509


how can f be used for both float and double arguments in printf? Are not they different types?

602


Under what circumstances does a name clash occur?

684


What is the process to generate random numbers in c programming language?

604