Difference between revisions of "CSC231 Final Exam Fall 2017"
Line 47: | Line 47: | ||
=Problem 2: C function= | =Problem 2: C function= | ||
<br /> | <br /> | ||
− | Write a C program and its header file containing a function called zap2() that will work similarly to the zap() function of Homework 9, but will replace '''all''' occurrences of the second string in the first string. The C program should be called '''final.c''' and the header file '''final.h'''. | + | Write a C program and its ''header file'' containing a function called zap2() that will work similarly to the zap() function of Homework 9, but will replace '''all''' occurrences of the second string in the first string. The C program should be called '''final.c''' and the header file '''final.h'''. |
''zap2()'' will return 1 if one or more substitutions occur, and 0 otherwise. Note that zap2() does '''not''' return the number of substitutions, just 1 or 0. | ''zap2()'' will return 1 if one or more substitutions occur, and 0 otherwise. Note that zap2() does '''not''' return the number of substitutions, just 1 or 0. |