CS 246 Lab 3
Spring 2017
Skim this introduction to Makefiles: http://www.cprogramming.com/tutorial/makefiles.html
Write a Makefile suitable to compile two files, main.c
and func.c
into an application app
. Test your Makefile by writing a short program with a function call (it can do anything you like – perhaps just add two numbers) spread into these files. The Makefile we developed in class this week is available.
You may wish to refer back to the examples listed next to class 4 from our syllabus.
In (a new file) reverse.c
, write a function int reverse_digits(int n)
that reverses the order of digits in a number.
Write a corresponding reverse.h
that declares the reverse_digits
function.
Write a check_reverse.c
file that runs unit tests on the reverse_digits
function.
Compile and check your work.
When you’re all done, post your work in a folder you create in our lab03 folder on GitHub.
Skim this introduction to GDB: http://web.eecs.umich.edu/~sugih/pointers/summary.html
Peruse this GDB reference card.
Use gdb
to learn more about the behavior of your attempt at problem 6 on hw02. Work with your partner on this, debugging one submission together.