实验具体做法:
#include <iostream>
#include <iomanip>
#include <ctime>
using namespace std;
#define NODE_SIDE 1000 // 1000~1000000
time_t startTime, endTime;
struct Node {
int num[NODE_SIDE];
};
void testByValue(Node a) {}
void testByReference(Node &a) {}
void testByPointer(Node *a) {}
int main() {
long long int TEST_TIME;
Node n;
n.num[0] = 2222; // why
int i;
for (int j = 1; j <= 1000; j *= 10) { // enlarge TEST_TIME
TEST_TIME = 1000000 * j;
i = TEST_TIME;
startTime = clock();
while (i--) {
testByValue(n