This page has bare-bones instructions to help you get started writing and running programs in the C programming language. It is far from complete and will only get you started. You will really learn how to program by practice. You will also learn how to make plots using the SuperMongo package, which is easy to use and quite powerful.
Here are three files to get you started:
Makefile: this file makes it easy to compile your code.
testprogram.c: this is a sample C program
file.dat: this is a sample data file
Compile the C program by typing "make testprogram". If it works and there are no errors, a new file called "testprogram" will appear. This is an executable file. You can run it by typing "testprogram number1 number2 < file.dat > outfile", where number1 and number2 are two numbers. You can play around with the C program and see how it works.
Here are some useful online references and tutorials:
Brian Kernighan's tutorial
C Library reference
Before you start writing SM scripts, set up a couple things:
1. Copy this .sm file into your home directory and edit the paths in the file to those for your machine.
2. Create a directory called "SMacro" in your home directory and put this default file in it. This will give you access to many SM macros that have been written by myself and others.
Now you can start writing scripts. Copy this sample script to your directory and run it by typing "sampleSMscript 10" (this script reads in the data file "file.dat" from before). The argument "10" is the number of seconds the figure will appear on your screen before SM quits. If you set that number to zero and follow with a filename, the figure will instead be saved as a postscript figure.
Here is a useful online SM reference: