swap two integer variables without using a third temporary
variable?
Answer Posted / sidhartha
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("\n ENTER 2 VALUES : ");
scanf("%d%d",&a,&b);
printf("\n THE VALUES BEFORE SORTING : %d,%d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("\n THE VALUES AFTER SORTING : %d,%d",a,b);
getch();
}
Is This Answer Correct ? | 40 Yes | 1 No |
Post New Answer View All Answers
Can you please explain the difference between syntax vs logical error?
Why void main is used in c?
Explain bit masking in c?
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
What are the advantages of the functions?
What is this pointer in c plus plus?
Write a c program to build a heap method using Pointer to function and pointer to structure ?
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }
What is the difference between union and structure in c?
Define macros.
Is null valid for pointers to functions?
What is the process to generate random numbers in c programming language?
What is volatile variable in c?
What is a scope resolution operator in c?
What are the types of type qualifiers in c?