answersLogoWhite

0

#include<iostream>

void swap(int* x, int* y)

{

int tmp = *x; *x=*y; *y=tmp;

}

int main()

{

int a=2, b=4;

std::cout<<"a="<<a<<", b="<<b<<std::endl;

swap(&a, &b);

std::cout<<"a="<<a<<", b="<<b<<std::endl;

}

User Avatar

Wiki User

11y ago

What else can I help you with?

Related Questions

What is swap in c plus plus programming language?

It is not a reserved word, so can be an identifier (name of a type/variable/function).


How can write the name in c plus plus language without using cout statement?

I believe, you can use C-function - printf().


How do you convert numeric value into alpha value in c plus plus programming language?

use the _itoa function


Difference between procedure and function in C or C plus plus or Java language?

In C there are functions only, In Java methodsonly (static methods as well), in C++ both.


What is self referential function in c plus plus?

A self-referential function in C++, or in any other supporting language, is a recursive function.


How to swap two numbers by call by reference in c plus plus?

void swap(int&amp; a, int&amp; b ) { a^=b^=a^=b; }


What are the building function in c plus plus?

There is no such term as "building function" in C++.


What are the interpreter in c plus plus?

C++ is a compiled language, not an interpreted language.


In computer language C plus plus is related to?

C++ is related to C, the language from which it is derived.


What is the difference between C plus plus and the original language?

C++ is easier to use as you have to learn slightly less and script slightly to make your function(s) work.


Is c plus plus a complied or interpreted language?

C++ is generally a compiled language.


What is the differnce between ordinary function and template function of c language?

The c language does not have template functions. That is a c++ thing.