Table of Contents
Programming for Social ScientistsLecture 2
Today’s topics
The 32 keywords of ANSI C
General structure of C program
HelloWorld.c
HelloWorld.c: Closer look
Compiling HelloWorld.c
What about these libraries?
Example library functions
C functions
Using the function in a program
Variable types and min range*)
More on variables
Know your variable types
C arithmetic
C shorthand
Relational operators
More on relational operators
Flow control: if-else
More on expressions
Flow control: for-next loops
Example: Printing an X
Printing an X using for-next and if-else
Flow control: do loops
Flow control: while loops
Flow control: switch
Switch example
Example: Random histogram
Example: Random histogram
Completing the program
Arrays in C
Multidimensional arrays
Multidimensional arrays (cont)
The random histogram using arrays
Incrementing an array value
Independent study
|
Author: Benedikt Stefansson
Email: benedikt@ucla.edu
Download presentation source
|