Program of swapping in c++, C/C++ Programming

Assignment Help:

Program of swapping two varibales:

void swap(int *, int *);   // This is swap's prototype

int main()

{

                int x = 5, y = 7;

                swap(&x, &y);

                cout << "\n x is now "<< x << " and y is now " << y << '\n';

 

                return 0;

}

void swap(int *a, int *b)    // swap is actually defined here

{

                int temp;

                temp = *a;

                *a = *b;

                *b = temp;

}


Related Discussions:- Program of swapping in c++

Program to check even and odd numbers, Program to check even and odd number...

Program to check even and odd numbers: int main() {                 int  your_number;                 cout                 cin >> your_number;

Explain the function fseek, Question: (a) Explain the function fseek()....

Question: (a) Explain the function fseek(). Using an appropriate example, write the full syntax for this function. (b) Write a C or C++ program that will perform the follo

Explain the bit fields portable or not, Explain the  bit fields portable o...

Explain the  bit fields portable or not? - No, Bit fields aren't portable. - As Bit fields can't span machine words and number of bits in a machine word is different on diff

Using c language, I have a program and I want someone to fix it for me by u...

I have a program and I want someone to fix it for me by using basic c language program.

Xmugler, #solution for decode the code for smuglers

#solution for decode the code for smuglers

Define difference among new & malloc?, Both malloc & new functions are util...

Both malloc & new functions are utilized for dynamic memory allocations & the basic difference is: malloc need a special "typecasting" while it allocates memory for eg. if the poin

, Question 1 / 1 You have an N x N chessboard and you wish to place N king...

Question 1 / 1 You have an N x N chessboard and you wish to place N kings on it. Each row and column should contain exactly one king, and no two kings should attack each other (two

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd