All pastes #55351 Raw Edit

Miscellany

public c v1 · immutable
#55351 ·published 2006-05-12 07:35 UTC
rendered paste body
#include <stdio.h>void worker(int arg, void (*function)(int fnarg)) {    if (arg < 5) return;        (*function)(arg);}void caller(int first_val) {    int last_val = first_val;        void difference(int eearg) {        printf("difference between now and last call: %d\n",          eearg - last_val);        last_val = eearg;    }        int i;    for (i = first_val + 1; i < 10; i++) {        worker(i, difference);    }}int main(void) {    caller(1);    caller(3);}