Logo 
Search:

C++ Programming Articles

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

Program of swapping numbers by call by reference

Posted By: Bittan Fischer     Category: C++ Programming     Views: 62385

Write a program of swapping numbers by call by reference.

Code for Program of swapping numbers by call by reference in C++ Programming

#include<iostream.h>
#include<conio.h>
void swap (int &a, int &b)
{
    /* &a and &b are reference variables */
int temp; temp=a; a=b; b=temp; } main() { clrscr(); int i=5,j=10; cout<<"Before swapping I = "<<i<<" J = "<<j<<endl; swap(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 by call by reference Or get search suggestion and latest updates.

Bittan Fischer
Bittan Fischer author of Program of swapping numbers by call by reference is from Frankfurt, Germany.
 
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!