Lecture 3: September 30, 2019
Reading
:
C text
, §2; [4, 5]
Due
: Homework #1, due October 9, 2019
Greetings and felicitations!
Change of classrooms for 2 discussion sections:
Discussion section A02 (Wed 5:10pm–6:00pm) moved from 223 Olson to 176 Chemistry
Discussion section A03 (Thu 1:10pm–2:00pm) moved from 223 Olson to 204 Art
Office hours for TAs posted
ssh
Tutorial is now up
To see which CSIF systems are up and which are down, go to
http://iceman.cs.ucdavis.edu/nagios3/cgi-bin/status.cgi?hostgroup=all
Example: making change
Add input using
scanf
Add error checking
Variable names
Basic types
int
,
long
vs.
short
,
unsigned
vs.
signed
char
, treated like an
int
that holds 1 character
float
,
double
Type casting
Basic operators
arithmetic:
+
,
−
,
*
,
/
,
%
%
defined so that
n
%
p
=
r
implies
n
=
ap
+
r
for some
a
5 % −2
can be 1 (5 = (−2) × (−2) + 1) or −1 (5 = (−3) × (−2) + (−1))
Associativity of operations
Difference between associativity of operations and order of evaluation
fahr2.c
#include <stdio.h>
Macros
float
for
loop
Handouts
Writing a Program
Precedence and Associativity of C Operators
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email:
[email protected]
ECS 36A, Programming and Problem Solving
Version of October 12, 2019 at 10:44AM
You can also obtain a PDF version of this.