call by reference c++ example
C++
//call by reference example c++
#include <iostream>
using namespace std;
void swap(int& x, int& y) {
cout << x << " " << y << endl;
int temp = x;
x = y;
y = temp;
cout << x << " " << y << endl;
}
int main() {
int a = 7;
int b = 9;
swap(a, b);
}
Also in C++:
- Title
- c++ clear console
- Category
- C++
- Title
- how to get os name in c++
- Category
- C++
- Title
- euler's totient function c++
- Category
- C++
- Title
- static_cast c++
- Category
- C++
- Title
- how to convert number to string
- Category
- C++
- Title
- find_if c++ example
- Category
- C++
- Title
- basic cpp programs
- Category
- C++
- Title
- __builtin_ctz
- Category
- C++
- Title
- array 2d to 1d
- Category
- C++
- Title
- array sort c++
- Category
- C++
- Title
- if not defined c++
- Category
- C++
- Title
- find all the palindrome substring in a given string
- Category
- C++
- Title
- c++ smart pointer 2d array
- Category
- C++
- Title
- how to convert string to int c++
- Category
- C++
- Title
- hashing in competitive programming
- Category
- C++
- Title
- *max_element in c++
- Category
- C++
- Title
- get index of value c++
- Category
- C++
- Title
- sleep system function linux c++
- Category
- C++
- Title
- how to extract substring from string in c++
- Category
- C++
- Title
- templates of templates c++
- Category
- C++
- Title
- binary serach in c++
- Category
- C++
- Title
- file reading c++
- Category
- C++
- Title
- c++ reading string
- Category
- C++
- Title
- program to know if a number is prime
- Category
- C++
- Title
- if vector contains value c++
- Category
- C++
- Title
- count a character in a string c++
- Category
- C++
- Title
- pop_back
- Category
- C++
- Title
- find_if c++
- Category
- C++
- Title
- initialize 3d vector c++
- Category
- C++
- Title
- vector concat c++
- Category
- C++
- Title
- vector stl c++
- Category
- C++
- Title
- convert int to binary string c++
- Category
- C++
- Title
- how to make a switch case statement in c++
- Category
- C++
- Title
- initialize int c++
- Category
- C++
- Title
- matrix multiplication c++ eigen
- Category
- C++
- Title
- gfg right view of tree
- Category
- C++
- Title
- pointers in cpp
- Category
- C++
- Title
- unordered_map of pair and int
- Category
- C++
- Title
- calculate sum in c++
- Category
- C++
- Title
- how to create object in c++
- Category
- C++
- Title
- find vector in c++
- Category
- C++
- Title
- using namespace std in c++
- Category
- C++
- Title
- maximum subarray sum equal with K in c++
- Category
- C++
- Title
- class is replace by structure
- Category
- C++
- Title
- c++ how to make a negative float positive
- Category
- C++
- Title
- gfg bottom view of tree
- Category
- C++
- Title
- c++ iterate over vector
- Category
- C++
- Title
- stack c++
- Category
- C++
- Title
- how to know the correct class of objects cpp
- Category
- C++
- Title
- balanced brackets hackerrank solution in cpp
- Category
- C++
- Title
- constant variables in c++
- Category
- C++
- Title
- mkdir boost filesystem
- Category
- C++
- Title
- graph using djacency matrix c++
- Category
- C++
- Title
- c++ how to return an empty vector
- Category
- C++
- Title
- change int to string cpp
- Category
- C++
- Title
- passing a vector to a function c++
- Category
- C++
- Title
- c++ push multiple elements to vector
- Category
- C++
- Title
- shortest path with bfs in c++
- Category
- C++
- Title
- cube mapping sdl
- Category
- C++
- Title
- new c++
- Category
- C++
- Title
- c++ string to integer without stoi
- Category
- C++
- Title
- insert function in c++ vector
- Category
- C++
- Title
- class in c++
- Category
- C++
- Title
- file format not recognized treating as linker script c++
- Category
- C++
- Title
- gcd in c++
- Category
- C++
- Title
- private and public in namespace cpp
- Category
- C++
- Title
- get line C++
- Category
- C++
- Title
- how to end a c++ program early
- Category
- C++
- Title
- count function c++
- Category
- C++
- Title
- how to iterate over unordered_map c++
- Category
- C++
- Title
- c++ return multiple values
- Category
- C++
- Title
- c++ initialise array
- Category
- C++
- Title
- dynamic 2d array c++
- Category
- C++
- Title
- c++ isalphanum
- Category
- C++
- Title
- capitalize first letter c++
- Category
- C++
- Title
- C++ Syntax
- Category
- C++
- Title
- substr in c++
- Category
- C++
- Title
- glfw initialize in c++
- Category
- C++
- Title
- repeating character in c++
- Category
- C++
- Title
- fast io c++ geeksforgeeks
- Category
- C++
- Title
- recursion in cpp with reference
- Category
- C++
- Title
- vector in c++ class
- Category
- C++
- Title
- modulo c++
- Category
- C++
- Title
- array as parameter c++
- Category
- C++
- Title
- how to make sure the user inputs a int and not anything else c++
- Category
- C++
- Title
- how to use wasd c++
- Category
- C++
- Title
- border radius layout android xml
- Category
- C++
- Title
- pow c++
- Category
- C++
- Title
- newline in c++
- Category
- C++
- Title
- how to iterate trough a vector in c++
- Category
- C++
- Title
- how to grab all of user input c++
- Category
- C++
- Title
- set mimetype validation in mongoose
- Category
- C++
- Title
- map.erase in c++
- Category
- C++
- Title
- zeros of array c++
- Category
- C++
- Title
- How to read a file in in C++
- Category
- C++
- Title
- c++ vector size
- Category
- C++
- Title
- how to convert string into number
- Category
- C++
- Title
- c++ program for matrix addition
- Category
- C++
- Title
- for loop
- Category
- C++
- Title
- how to find the size of a character array in c++
- Category
- C++