Commonwealth of Australia: Act 1968 (The Act)
Commonwealth of Australia: Act 1968 (The Act)
WARNING
Dr Tele Tan
Outcomes
/* File: helloWorld.c
** Programmer: G. West
** Date: 5 March 2008 pseudo code
*/
#include <stdio.h> start
output Hello Word
int main(void) end
{
printf("Hello World\n");
return 0;
}
Program in memory
Compilation
Edit a file called hello.c using an editor (vi,
vim, gvim, gedit etc.)
Compile with gcc:
% gcc hello.c
Produce an executable file named a.out
Run
% a.out
Hello World
%
Doing arithmetic
Program to multiply two numbers together
#include <stdio.h>
pseudo code
int main(void)
{ start
int i,j,k; i, j and k are integers
set i to be 3
i = 3; set j to be 5
j = 5; set k to be i * j
output result: k
k = i * j; end
printf(result: %d\n,k);
}
Doing arithmetic with input
Program to multiply two inputted numbers together
#include <stdio.h>
int main(void)
{
int i,j,k;
pseudo code
k = i * j;
start
printf(result: %d\n,k); i, j and k are integers
} output input two integers to multiply
input i and j
k is i * j
output result: k
end
Today we discussed
Basic computer history
Unix and some commands
C language and why needed
Programs, algorithms and pseudo code
Mechanics of writing and executing a
program
Some example programs
ETAP Starts Week 3 (15 Mar)
When
Tue, 1pm 5pm
Tue, 1pm 5pm
Where
204:305
Whats next?
Practical
Familiarise yourself with Linux
Try out writing simple C programs
Meet our wonderful and caring practical tutors
Lecture Next Week
Language fundamentals