CS140 Lab 4 - Exploring data representation

Objective

  • Experiment with data representations in C.
  • Review C programming.

Background

This material is from Chapter 2 in CS:APP textbook.

Required Tasks

    Experiment with Data Representations



  1. Log into your Linux account on one of the CS machines.
  2. Download show_bytes.c.
    From the Linux command line, this will get the file and copy it to your local directory:
    wget http://www.cs.clarku.edu/~jmagee/cs140/labs/lab04/show_bytes.c
  3. Examine this program and try to figure out what it does.
  4. Compile with gcc: gcc show_bytes.c -o show_bytes
  5. Run this program with several (at least 10) different inputs. Try 0, 1, 2, etc.
  6. Try to explain the resulting output.

    See worksheet for tasks: CS140Lab4Worksheet.pdf

Check out



When you are done with the lab exercises, submit your worksheet on Gradescope by the end of the day.