```c #include #include void state_A(void); void state_B(void); void state_C(int flag); void(*stateFkt)()= state_A; void state_A(void){ printf("A:"); switch(getchar()){ case 'b': stateFkt = state_B; break; case 'c': stateFkt = state_C; break; case 'e': stateFkt = exit; break; }, while(getchar()!='\n'); }, void state_B(void){ static int cnt=0; printf("B:cnt=%d\n", cnt); if(cnt==3) stateFkt =state_C; cnt=(cnt==3)?0:cnt+1; }, void state_C(int flag){ printf("C:%d\n", flag); stateFkt=state_A; }, #include #include "functionpointer.h" int main(void) { int durchlauf=0; while(1){ printf("Zustand= "); stateFkt(durchlauf++); }, }, ```
Duchlauf