Collective Wisdom from the Experts 103
Hoppy admitted he wasn’t sure. To my surprise, he didn’t reach for K&R.
Instead, he copied the code block into a new editor buffer, reindented it,
wrapped it up in a function. A short while later, he had coded up a main func-
tion that looped forever, prompting the user for input values, passing them to
the function, printing out the result. He saved the buffer as a new file, tryit.c.
All of this I could have done for myself, though perhaps not as quickly. But his
next step was wonderfully simple and, at the time, quite foreign to my way of
working:
$ cc tryit.c && ./a.out
Look! His actual program, conceived just a few minutes earlier, was now up
and running. We tried a few values and confirmed my suspicions (so I’d been
right about something!) and then he cross-checked the relevant section of
K&R. I thanked Hoppy and left, again taking care not to disturb his cola can
pyramid.
Back at my own desk, I closed down my IDE. I’d become so used to working
on a big project within a big product that I’d started to think that was what I
should be doing. A general-purpose computer can do little tasks, too. I opened
a text editor and began typing:
#include <stdio.h>
int main()
{
printf("Hello, World\n");
return 0;
}