Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Latest commit

History

History
21 lines (15 loc) 路 424 Bytes

swap.md

File metadata and controls

21 lines (15 loc) 路 424 Bytes

swap

Description :

  • Exchange values of two objects

Example

	//Declare two example objects (same type)
	int a = 60, b = 50;

	//a:60 and b:50
	std::cout<<"Before: "<<"a = "<<a<<" and b = "<<b<<"\n";

	std::swap(a,b); 	

	//a:50 and b:60, after swap
	std::cout<<"After: "<<"a = "<<a<<" and b = "<<b;

See Sample code Run Code