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


Please Help Members By Posting Answers For Below Questions

simple program of graphics and their output display

1470


Why doesnt long int work?

614


Explain how can you avoid including a header more than once?

604


How are variables declared in c?

600


How can type-insensitive macros be created?

702






Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.

1621


What is difference between structure and union in c?

549


Why do we use pointer to pointer in c?

600


What is c programing language?

616


How can I find the modification date of a file?

706


What is the difference between array and linked list in c?

603


Hi can anyone tell what is a start up code?

1617


if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0

1453


What is the ANSI C Standard?

781


Dont ansi function prototypes render lint obsolete?

607