Intro to C #1: bases and bits

Starter code: bases-and-bits-package.tar
Upload via Moodle only your completed copy of bases-and-bits.c

Goals

Rubric

1 - author name in comment at top of your C source file 3 - print_integer_in_binary 3 - count_one_bits 2 - code quality

Programming assignment #1: bases-and-bits

For this assignment, you will implement two C functions involving the C int type. One of these functions, void print_int_in_binary(int n), once implemented, will do just as its name says. The other, int count_one_bits(int n) will count the number of 1 bits found in the binary representation of n.

Neither function requires a lot of code, but both will require you to think clearly about the binary representation of integers, and how that representation can be accessed directly in C.

A few concepts and C constructs you might find useful for this assignment:

Homework packages for this class

Several of the assignments for this class will include a package of starter code plus other infrastructure. I will generally deliver each package to you as a tar file, which is an old-school but very common way of sharing a collection of documents as a single file.

Part of the goal of this assignment is to get you familiar with the code packages we will use.

What you should do

Have fun!

Don't by shy about experimenting and asking lots of questions.