#include auto make_counter(int start){ int place = start; return [=](){ static int p = place; p++; printf("Increasing count to: %d\n", p); return p; }; } int main(){ auto from2 = make_counter(2); printf("from2 returned: %d\n", from2()); printf("from2 returned: %d\n", from2()); printf("from2 returned: %d\n", from2()); auto from17 = make_counter(17); printf("from17 returned: %d\n", from17()); printf("from17 returned: %d\n", from17()); printf("from17 returned: %d\n", from17()); return 0; }