I've been programming in C since the early 1980's, before C++ was invented.
Back then computers weren't as fast as they are now so we had to make every line of code work hard. Did you know you can execute one element in an array of function pointers ? I use the tiny-C compiler so this is an entire program and cleanly compiles to a 1,536 byte executable.
Here is some code for you to chew on (take this code and run with it);
Code:
int fn1(int), fn2(int);
main()
{
int (*fnptr[2])(int);
int i = 0;
printf("Hello world!\n");
fnptr[0] = &fn1;
fnptr[1] = &fn2;
while(i=(*fnptr[i])(i));
}
int fn1(int i)
{
printf("Hello world fn1 got %d!\n",i);
return(1);
}
int fn2(int i)
{
printf("Hello world fn2 got %d!\n",i);
return(0);
}
See if you can determine it's output before you compile & run it.
If you put the functions before the main, you don't need the function declarations. We removed much of the white space to save on file size, it was an issue back then. We recognized ram in kilobytes, megabytes weren't really invented yet. I'm pretty sure you didn't want one long line.
It's elegant in its simplicity. When I had thousands of functions to fulfill, I would write a program that would write the program I compiled. I could take 2 days writing the program or 2 hours writing a program that would write the program for me.