write a program to swap Two numbers without using temp variable.
Answer Posted / yash paranjape
a=a^b;
b=a^b;
a=a^b;
i.e
a^=b;
b^=a;
a^=b;
more simplifie i.e in just one line
a^=b^=a^=b;
This also works fine
| Is This Answer Correct ? | 2 Yes | 1 No |
Post New Answer View All Answers
Difference between MAC vs. IP Addressing
What is the sizeof () operator?
How can I trap or ignore keyboard interrupts like control-c?
What is the difference between malloc calloc and realloc in c?
How do you define CONSTANT in C?
What are c identifiers?
What are the application of c?
What is a program flowchart and how does it help in writing a program?
FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2)} a.error b. c. d.
What is const and volatile in c?
For what purpose null pointer used?
What are structure members?
Explain bit masking in c?
Is register a keyword in c?
Can main () be called recursively?