Logo 
Search:

C++ Programming Articles

Submit Article
Home » Articles » C++ Programming » Homework HelpRSS Feeds

Program of swapping numbers using pointers

Posted By: Noah Bouchard     Category: C++ Programming     Views: 10360

Write a program of swapping numbers using pointers.

Code for Program of swapping numbers using pointers in C++ Programming

#include<iostream.h>
#include<conio.h>
void kal(int *a,int *b)
{
    int *temp,i;
    temp=&i;
    *temp=*a;
    *a=*b;
    *b=*temp;
}

main()
{
    clrscr();
    int i=5,j=10;
    cout<<"Before swapping I = "<<i<<" J = "<<j<<endl;
    kal(&i,&j);
    cout<<"After swapping I = "<<i<<" J = "<<j<<endl;
}
  
Share: 


Didn't find what you were looking for? Find more on Program of swapping numbers using pointers Or get search suggestion and latest updates.

Noah Bouchard
Noah Bouchard author of Program of swapping numbers using pointers is from Montreal, Canada.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!