cpp_prac/junk/2.cc

18 lines
299 B
C++
Raw Permalink Normal View History

2025-01-10 08:15:31 +01:00
#include <cstdlib>
#include <iostream>
void consume_number(int *p) {
2025-01-11 17:54:29 +01:00
std::cout << "Consuming: " << *p << std::endl;
delete p;
2025-01-10 08:15:31 +01:00
}
void random_int(int &out) { out = rand(); }
void use2() {
2025-01-11 17:54:29 +01:00
int i;
random_int(i);
consume_number(&i);
2025-01-10 08:15:31 +01:00
}
2025-01-11 17:54:29 +01:00
int main(int argc, char *argv[]) { use2(); }