/c-examples

simple examples of useful C programs

Primary LanguageC

c-examples

simple examples of useful C programs

Pick up a programming book. If it’s not K&R, the chapters will be labelled control flow, lists, scalars, filehandles, …. If it’s K&R, the organisation will at least be readable, but you

Can somebody just show me some examples of small programs that actually do something?!

I don’t care about "hello world", computing factorial, or changing rounding in a console that my actual users don’t even know exists.

My belief is that even non-programmers can, with

  • a few weeks’ time
  • a limited, clear set of instructions
  • non-geeklord names for variables and functions (no foo, no factories, concrete descriptions)
  • working examples of programs that do things a person might actually want done

edit said programs to get a closely related thing done.

After this first, crucial "cookbook" step, all the blogs about pointers, arrays, and parsing might make some sense.

So, these are presented with the hope that eventually you will read about linkers, objects, stack/heap, registers, … and never need to paw through monstrous programmer debates just to find a simple answer to a simple question.