#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)
2007 to 2023 HP and Dell Servers Comparison
HP Gen5 to Gen11 using ChatGPT HP ProLiant Gen Active Years CPU Socket Popular HP CPUs Cores Base Clock Max RAM Capacity Comparable Dell ...
-
https://www.tutorialspoint.com/ Q Data Types There are a lot of data types in Q, including boolean byte short int long real float cha...
-
CME MDP 3.0 Market Data http://www.cmegroup.com/confluence/display/EPICSANDBOX/CME+MDP+3.0+Market+Data CME Market Data Platform has 3 ...
-
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) ...