Homework 2 (Due Tuesday 21 June 2548)

For all students

  1. Write the data definition for a list of characters (call it ListOfChar)
  2. Write the C code for the above data structure including at least 5 data examples

For students with ID ending with 0, 3, 6, 9

3. Write a function (count_a) to count number of characters ‘a’ in a list of character.

For students with ID ending with 1, 4, 7

3. Write a function (count_not_z) to count number of characters not equal to ‘z’ in a list of character.

For students with ID ending with 2, 5, 8

3. Write a function (count_M) to count number of characters ‘M’ in a list of character.

Bonus question

4. Write a function (count_beyond_k) to counter number of characters after (not include) character ‘k’ in a list of number.  (l, m, n, o, p, …, z, A, B, …, Z) are counted but character a, b, …, k are not counted.