Help:C examples

From MMAE

Jump to: navigation, search

<<Back to Help:Contents

These are some simple examples of programs written in C. These were written as part of a crash course lecture on programming in C.

hello.csimplest C program
error1.c some common errors in C
ex1.c sample: function, math constant, loop, local vars, printf with format
ex2.c modify ex1 to use scanf and prompting
ex3.c use of rand [0-1), exp, list other trancendentals and constants
ex4.c read input from a file: command line, fopen, fscanf, perror, feof
sample.txt sample input for ex4
ex5.c example use of an iterative solver
matrix1.c fixed size matrix
Personal tools