Код
cat 1.c
#include <stdio.h>
typedef struct _my_struct{
void (*on_event)(struct _my_struct * a_struct);
char *eventarg;
} my_struct;
void parcearg(my_struct *s){
printf("arg: %s\n", s->eventarg);
}
int main(int argc, char **argv){
my_struct s = {parcearg, NULL};
int i;
for(i = 1; i < argc; ++i){
s.eventarg = argv[i];
s.on_event(&s);
}
return 0;
}
gcc 1.c -Wall -Werror -Wextra && ./a.out hello world
arg: hello
arg: world