#include <iostream>
#include <time.h>
void function1(int *ptr) { // pass by pointer
*ptr *= 5;
}
void function2(int val) { // pass by value
val *= 5;
}
void function3(int& ref) { // pass by reference
ref *= 5;
}
int main() {
int nmbr = 5;
clock_t start = clock();
for (long i = 0; i < 1000 * 1000 * 1000; ++i) {
function1(&nmbr);
//function2(nmbr);
//function3(nmbr);
}
clock_t stop = clock();
std::cout << "time: " << stop - start;
return 0;
}
訂閱:
文章 (Atom)
2023 Promox on Morefine N6000 16GB 512GB
2023 Promox on Morefine N6000 16GB 512GB Software Etcher 100MB (not but can be rufus-4.3.exe 1.4MB) Proxmox VE 7.4 ISO Installer (1st ISO re...
-
On CentOS 7, using yum install gives you cmake version 2.8.11 [root@thrift1 ~]# cat /etc/*release CentOS Linux release 7.2.1511 (Core) ...
-
Synology DSM 5.2 on Virtual Box Files On my Google Drive "2016DSM5.2" or download link below (3 files total: pat, iso, exe) ...
-
Static ZeroMQ (difficult setup) cd /d C:\ mkdir Repos cd /d C:\Repos\ git clone https://github.com/Microsoft/vcpkg cd /d C:\Repos\v...