ECE-1021

HOMEWORK #4

(Last Mod: 27 November 2010 21:38:39 )

ECE-1021 Course Homepage

ECE-1021 Semester Homepage


Objectives


String Output

Write the following function to print a string to the screen.

int PutS(const char *s);

This function accepts a pointer to memory where a null-terminated string is stored. The function returns the number of characters that were printed. 

The "const" qualifier is not required by the compiler (it IS required by this homework assignment). This qualifier just tells the compiler that we do not intend to change the value s or anything it points to. This let's the compiler flag attempts we may inadvertently make to do so.

Now that you have a function that can output strings, you are expected to make your program output significantly more presentable than was acceptable when you were limited to character-by-character output.

Rewrite the PrintHeader() function ( call it MyPrintHeader() ) so as to eliminate all calls to printf(). You many only use functions that you have written and/or worked with up to this point in the course.

Your main() should call PrintHeader(), then print a blank line, then call MyPrintHeader().