Download code |
Easy to read
|
A brief description |
hello.c
|
hello.c
|
A simple "Hello World" program
|
sqroot.c
|
sqroot.c
|
A program to read in a number and calculate the square root
|
for_loop.c
|
for_loop.c
|
This program uses a for loop to read in data to an array, x, and then sum
the numbers in the array
|
while_loop.c
|
while_loop.c
|
This program uses a while loop to read in data to an array, x, and then
sum the numbers in the array
|
function.c
|
function.c
|
This program is an example of how to use functions in C
|
pointer_values.c
|
pointer_values.c
|
A program to show the difference between a pointer and
its dereferenced value.
|
swap.c
|
swap.c
|
This program uses a function and pointers to swap the value of two
variables in the calling environment.
|
strings.c
|
strings.c
|
A short program that prints out parts of a string, accessed using a
pointer.
|
sea.c
|
sea.c
|
A program to explore strings, arrays and pointers |
mysterycode.c
|
mysterycode.c
|
If you like a challange .... You can compile and run this program
as usual to see the output! Merry Christmas! |
number_sum.c
|
number_sum.c
|
This program demonstrates reading and writing data to files. |
bisection.c
|
bisection.c
|
The bisection program from the 16.01.01 lecture.
|
newton-raphson.c
|
newton-raphson.c
|
A program to implement the Newton-Raphson algorithm for a specific function,
f(x).
|
|
Data tables
|
Tables of data comparing
analytic, Euler and second order Runge-Kutta results for
|
Euler.c
|
Euler.c
|
The Euler program. This program solves the ODE
Try changing the step size and compare the results the analytic solution ...
you should see something like this plot
|
Runge-Kutta.c
|
Runge-Kutta.c
|
A program to use fourth order Runge-Kutta to solve the
Harmonic oscillator (with friction). The plots corresponding to different
2b and w2 are
here.
|
Simpson.c
|
Simpson.c
|
The C code to implement Simpson's Rule.
The number of steps is taken to be 20. |
mem_map.c
|
mem_map.c
|
The program used for 1 last memory map example!
|
vectors_withfncs.c
|
vectors_withfncs.c
|
Calculates the dot and cross product of 2 vectors in C functions
|
matrix_add.c
|
matrix_add.c
|
Program that adds two matrices in a function and returns the resulting
matrix from the function
|
GaussElimination.c
|
GaussElimination.c
|
Program that does gaussian elimination with partial pivoting and
abck-substitution to solve a 3x3 matrix equation.
|
Employee1.c
|
Employee1.c
|
Program using structures to store and manipulate information about
employee(s) of a company. This is the first in a series of like programs
to illustrate the use of structures.
|
Employee2.c
|
Employee2.c
|
Version for many employees
|
Employee3.c
|
Employee3.c
|
Version using pointers.
|
bubble.c
|
bubble.c
|
The bubble sort program. The array, a is initialised -
you can change the values.
|
selectionsort.c
|
selectionsort.c
|
The selection sort program. Note the swap function is not called for each
value of the index i but only once the largest number in the list has
been found. We keep track of where this largest number is by saving its array
index in current_max_index. Note the value of this largest number is
never used.
|
merge.c
|
merge.c
|
A program to merge two already sorted arrays
|
sortmerge.c
|
sortmerge.c
|
A program to sort a list using the merge technique.
Extra comments about this code.
|
lotto.c
|
lotto.c
|
A program to generate 6 random numbers using the clock to seed the
generator
|
Schol-04.Q2
|
|
Question 2 on Schol paper 2004, the three functions are given here.
|