-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
26 lines (19 loc) · 391 Bytes
/
Copy pathmain.cpp
File metadata and controls
26 lines (19 loc) · 391 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include <iostream>
#include <thread>
#include <time.h>
int main() {
int seed = (int)time(0);
srand(seed);
int value = rand() % 255;
int* addr = &value;
do {
// copy value
int v = value;
// output
std::cout << v << " (";
printf("0x%p", addr);
std::cout << ")" << std::endl;
// wait 1 second
std::this_thread::sleep_for(std::chrono::seconds(1));
} while (true);
}