Lecture 3: September 30, 2019

Reading: C text, §2; [4, 5]
Due: Homework #1, due October 9, 2019


  1. Greetings and felicitations!
    1. Change of classrooms for 2 discussion sections:
      1. Discussion section A02 (Wed 5:10pm–6:00pm) moved from 223 Olson to 176 Chemistry
      2. Discussion section A03 (Thu 1:10pm–2:00pm) moved from 223 Olson to 204 Art
    2. Office hours for TAs posted
    3. ssh Tutorial is now up
    4. 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
  2. Example: making change
    1. Add input using scanf
    2. Add error checking
  3. Variable names
  4. Basic types
    1. int, long vs. short, unsigned vs. signed
    2. char, treated like an int that holds 1 character
    3. float, double
    4. Type casting
  5. Basic operators
    1. arithmetic: +, , *, /, %
    2. % defined so that n % p = r implies n = ap + r for some a
    3. 5 % −2 can be 1 (5 = (−2) × (−2) + 1) or −1 (5 = (−3) × (−2) + (−1))
  6. Associativity of operations
    1. Difference between associativity of operations and order of evaluation
  7. fahr2.c
    1. #include <stdio.h>
    2. Macros
    3. float
    4. for loop

Handouts

  1. Writing a Program
  2. Precedence and Associativity of C Operators

UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
ECS 36A, Programming and Problem Solving
Version of October 12, 2019 at 10:44AM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh