Next: Dynamic Memory Allocation Up: Pointers Previous: Illegal indirection


  1. Write a C program to read through an array of any type using pointers. Also scan through this array to find a particular value.

    (example only - cannot be marked by ceilidh)

  2. Write a program to find the number of times that a given word(i.e. a short string) occurs in a sentence (i.e. a long string).

    Read data from standard input. The first line is a single word, which is followed by general text on the second line. Read both up to a newline character, and insert a terminating null before processing.

    Typical output should be:

            The word is "the".
            The sentence is "the cat sat on the mat".
           The word occurs 2 times.


  3. Write a program that takes three variables (a, b, c) in as separate parameters and rotates the values stored so that value a goes to be, b, to c and c to a.

Fri May 20 13:40:49 BST 1994