C program to swap the two values, C/C++ Programming

Program is to swap the two values which are enter by user:

Program is to swap the two values which are enter by user through the function with values changed using pointers

void swap(int *p,int *q);

void main()

 {

 clrscr();

 int a,b;

 cout<<" enter the number ";

 cin>>a;

 cout<<" enter the number ";

 cin>>b;

 swap(&a,&b);

 cout<<" the numbers after the value being changed "<<"\n"<

 }

 

void swap(int *p,int *q)

 {

  int r;

   r=*p;

  *p=*q;

  *q=r;

 }

Posted Date: 10/19/2012 7:59:31 AM | Location : United States







Related Discussions:- C program to swap the two values, Assignment Help, Ask Question on C program to swap the two values, Get Answer, Expert's Help, C program to swap the two values Discussions

Write discussion on C program to swap the two values
Your posts are moderated
Related Questions
Add a function for saving the text stored in an array to a file. Your program must check whether or not the output file already exists, and if it does, your program must ask the us

What are pre-processor directives? - Pre-processor directives are placed at the beginning of a C program. They begin with # symbol. - This is the place, where library files

A: The inline keyword tells the compiler to substitute the code in the function de_nition for each instance of a function call. Though, substitution takes place only at the compile

What data structure would you mostly likely see in a nonrecursive implementation of a recursive algorithm?Minimum 100 words accepted#

Employ operator () instead of operator[]. While you have multiple subscripts, the cleanest way to do it is along with operator () instead of with operator[]. The reason is that

HOW THE C PROGRAM CODING IMPLEMENTED DY ITSELF UNDERSTANDING . ALSO HOW I CAN A BECOME A GOOD PROGRAMMER IN C WHAT I DO FOR GOOD PROGRAMMING ,TELL ME HOW C CODING DEVELOP DY ITSELF

write a program to calculate the cuboid

Aim: To implement a program to add two complex numbers using constructors. Code:                       class complex {             int real;             int img;

Suppose that three integer variables intA, intB, and intC have already been defined at the beginning of the main function, write a single C++ statement to read three integers from

Is it possible to create your own header files? - Yes, it's possible to create a customized header file. - To do this, you just need to include function prototypes that you