Lecture 3: April 7, 2023

Reading: zyBooks text, §2.20; [2]


Outline
  1. Greetings and felicitations!
    1. ssh Tutorial is now up; Use your CAS (Kerberos) name to log in
      1. ssh CAS-login-name@pcnn.cs.ucdavis.edu
      2. Important: If you do not use your CAS login, you will not log in!
    2. 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 [fahr1.c]
    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. A more sophisticated Fahrenheit to Celsius temperature converter [fahr2.c]
    1. #include <stdio.h>
    2. Macros
    3. float
    4. for loop

  8. Debugging: find the error! [fahr2-buggy.c]

Handouts

  1. vim Tutorial vim.pdf

UC Davis sigil
Matt Bishop
Office: 2209 Watershed Sciences
Phone: +1 (530) 752-8060
Email: mabishop@ucdavis.edu
ECS 36A, Programming & Problem Solving
Version of April 6, 2023 at 3:44PM

You can also obtain a PDF version of this.

Valid HTML 4.01 Transitional Built with BBEdit Built on a Macintosh