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
I want MODI method''s coding in c++ using all concepts of c++..please help me its my project work...

Within software engineering, software is very rarely written by a single software engineer. Usually a team of engineers write a program; therefore a formal structural design approa

What is Ms dos?

An anagram is a type of word play, the result of rearranging the letters of a word or phrase to produce a new word or phrase. For example the anagram of tea is tea, tae, eat, eta,

finds the average for all assignments for an individual student float getAverageForStudent(float scores[20][10], int student, int numAssignments) {  }  // finds the average for

Bubble sort C program: Write a program to define a bubble sort. void main()  {   clrscr();   int a[100],ch,n;   cout   cin>>n;   for (int i=0;i

Binomial coefficients are the numeric factors of the products in a power of a binomial such as (x + y)n. For example, (x + y)2 = x2 + 2 x y + y2 has the coefficients 1 2 1. Binomia

Write a C++ program doing the following: The program reads from the keyboard the numbers of rows and columns of a 2-D array of integers. Then, it allocates this array (let’s name i

Conversion between Objects of Different Classes As the compiler does not know anything about the user-defined type, the conversion instructions are to be specified in a functio

Train Station C++ Program A C++ program that provides a simple text based interface that will allow a user to create, edit, search, or delete a train schedule. The program will m