Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Functions-Part I
#include <iostream> // First version: Pass by value // void swap (int a, int b) { // int tmp = b; // b = a; // a = tmp; // } // Second version: Pass by pointer // void swap (int* a, int* b) { // int tmp = *b; // *b = *a; // *a = tmp; // } // Third version: Pass by reference // void swap (int& a, int& b) { // int tmp = b; // b = a; // a = tmp; // } // Template version: /* template<typename T> void swap (T& a, T& b) { T tmp = b; b = a; a = tmp; }*/ int main() { // auto A = 1; // auto B = 2; /* auto A = "Hello"; auto B = "World"; std::cout << A << " " << B << std::endl; swap (A, B); std::cout << A << " " << B << std::endl; */ return 0; }
run
|
edit
|
history
|
help
0
RegTokIt
Test 15(2020)
4C test
QP
10954
shell sort
Problema1
e-olymp.com---problem1590---Birthday 2
StrStrPbrk
Elevator 3