| 1 | #include <stdio.h> |
| 2 | |
| 3 | int increment_val(int n) { |
| 4 | return n + 2; |
| 5 | } |
| 6 | |
| 7 | // ~26% faster |
| 8 | void increment_ptr(int* n) { |
| 9 | *n += 2; |
| 10 | } |
| 11 | |
| 12 | int main() { |
| 13 | int n = 0; |
| 14 | for (int i = 0; i < 1000000000; i++) { |
| 15 | n = increment_val(n); |
| 16 | //increment_ptr(&n); |
| 17 | } |
| 18 | printf("%d\n", n); |
| 19 | return 0; |
| 20 | } |
| 21 | |
| 22 |