Pointers

Additional Exercises


  1. Write a function strn_comp to compare two strings. The function will return a value TRUE if the strings are the same and FALSE otherwise. Call this function from a main program.

    The return value will be of type int with TRUE indicated by a value of 1 and FALSE indicated by a value of 0.

    Note: this can be achieved using array indices or pointers to manipulate the string.

  2. Rewrite the main program for the example given under Additional Example 2 for Functions to take the values of a, b, and c as command line arguments, instead of prompting the user to enter the values.


    Back to Main Page for Lecture 7