24 lines
305 B
C++
24 lines
305 B
C++
#include "iter.hpp"
|
|
#include <iostream>
|
|
|
|
void increment(int &nb)
|
|
{
|
|
nb++;
|
|
}
|
|
|
|
void print(const int &nb)
|
|
{
|
|
std::cout << nb << " ";
|
|
}
|
|
|
|
int main(void)
|
|
{
|
|
int arr[4] = {1, 2, 3, 4};
|
|
|
|
iter(arr, 4, &print);
|
|
std::cout << std::endl;
|
|
iter(arr, 4, &increment);
|
|
iter(arr, 4, &print);
|
|
std::cout << std::endl;
|
|
}
|