1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <stdio.h> void bar() { puts("nothing..."); } int foo() { static int count = 1; return (bar(), count)++; } int main() { printf("return = %d\n", foo()); printf("return = %d\n", foo()); printf("return = %d\n", foo()); return 0; }
1 2 3 4 5 6
nothing... return = 1 nothing... return = 2 nothing... return = 3