Jan 29
preliminaries
unix command line
- cs account
- unix command line 101:
ssh scp
man more nano
~ . .. ls cd mkdir rm
gcc make chmod > < & %
alias bash .bashrc
printenv (echo $PATH)
editing, compiling, running a C program
There are a number of methods;
discuss which ones you like and common practices.
/* total.c | Jim M
* simple class example
*
* $ gcc total.c -o total
* $ ./total
* Total of integers from 17 to 203 is 20570.
*/
#include <stdio.h>
int main(){
int i;
int low = 17;
int high = 203;
int total = 0;
for (i = low; i <= high; i++){
total += i;
}
printf("Total of integers from %i to %i is %i.\n", low, high, total);
return 0;
}
Look at your examples :
Then look deeper at types, sizeof(), pointers, struct using my code
in
C examples :
See how far we get, and continue Thursday with more C and
the bit/byte/int/data material in chapter 2.
Topics coming up:
- What does a C program spread over several files look like? How do you compile and run it?
- More examples of pointers, and how they connect with lists.
- C character and string data.
- Details of memory and data : int, long, hex, bits, bytes, and all that (chap 2 in text)