Assignment #7

Introductory C Programming

UW Experimental College

Assignment #7


Assignment #7
Assignment #6 Answers
Class Notes, Chapter 14

Reading Assignment:

Class Notes, Chapters 12 and 13

Review Questions:

  1. What do we mean by the ``equivalence between arrays and pointers'' in C?
  2. If p is a pointer, what does p[i] mean?
  3. Can you think of a few reasons why an I/O scheme which did not make you open a file and keep track of a ``file pointer,'' but instead let you just mention the name of the file as you were reading or writing it, might not work as well?
  4. If argc is 2, what is argv[1]? What if argc is 1?


  1. Rewrite the replace function from last week to remove the restriction that the replacement substring have the same size. Be sure to test it on replacement strings which are larger, smaller, and the same size. Should it work if the replacement string is the empty string?
  2. Rewrite the pattern matching program (Assignment 6, Exercise 1) to prompt the user for the name of the file to search in and a pattern to search for.
  3. Rewrite the pattern matching program (Assignment 6, Exercise 1) to accept the pattern and file name from the command line (like the Unix grep or MS-DOS find command).

This page by Steve Summit // Copyright 1995-9 // mail feedback