Lab tests next week: November 24 and 26!!
This lab involves conversion of an array of char
to an array of integers with values limited to be 0 or 1. The array is
going to be interpreted as a positive integer with binary digits as found
in the array. Recall that any positive integer can be represented with
place notation in any base, for example the the integer we write as 105 in
decimal notation is actually
1 x b2 + 0 x b1 + 5 x b0
where b, the base is 10 in this case, and the coefficients of powers of b must come from a set of b symbols for digits: 0,1,2,...,b-1. We already considered b = 8 on an assignment. Here we will work with b = 2. What happens if b is greater than 10? In that case we need more symbols than the usual digits 0,1,...,9 so what is commonly done is to adopt the upper case Latin alphabet. An important case (Why?) is b = 16 = 24! where the digits are 0,1,...,9,A,...,F.
A collection of stub functions and a main driver program has been written for you. The function stubs are written just to let the program execute but not correctly. Your job is to `fill' in the missing statments; please follow the order below.
Write the inputs you used for testing at the bottom of this sheet to show to the lab instructor.
Function print_bin Test Values:
Function int_2_bin Test Values:
Function bin_2_int Test Values: