This is an old-school C implementation to answer question 4 from tutorial set 1 from my Information Theory course (2010). The C program writes a text file and the plotting is done by gnuplot (I used gnuplot 4.2 patchlevel 6). *** I wouldn't normally write code for this sort of problem in C. *** I recommend using an interactive, feature-rich programming environment when exploring new topics. I have also provided a Matlab/Octave answer to this question as an example. I provided this implementation because I got some questions from people attempting to use more bare-bones programming environments. Plain ANSI C seems like a lowest common-denominator that you could generalize to your favourite programming environment. If you don't want to leave your favourite programming language, output to text files and learn how to use some plotting package that can work from text files. Gnuplot can be ok. Or of course you could use Matlab/Octave just for plotting, or R, or python+matplotlib... The demo will work on most Unix-like distributions out of the box, although you may have to install gnuplot (also required are a C compiler, bash and ghostscript). All the dependencies are available for Windows. doit bash script to run the whole demo eventually creating hist.pdf gnuplot.cmd gnuplot commands hist.c ANSI C program to generate hist.txt containing bin centers, histogram counts, and mean predictions using the central limit theorem Iain Murray, October 2010