Difference between revisions of "CSC231 Final Exam Fall 2017"
Line 59: | Line 59: | ||
<br /> | <br /> | ||
* Submit your file in the Problem 3 section of the final exam on Moodle. | * Submit your file in the Problem 3 section of the final exam on Moodle. | ||
+ | <br /> | ||
+ | ==Solution Zap Function from HW 9== | ||
+ | <br /> | ||
+ | ::<source lang="C"> | ||
+ | int zap( char *s1, char *s2 ) { | ||
+ | int i, ret=0; | ||
+ | char *p = strstr( s1, s2 ); | ||
+ | |||
+ | if ( p!=NULL ) { | ||
+ | ret = 1; | ||
+ | for ( i=0; i<strlen( s2 ); i++ ) | ||
+ | *(p++) = '-'; | ||
+ | } | ||
+ | return ret; | ||
+ | } | ||
+ | </source> | ||
+ | <br /> | ||
<br /><br /> | <br /><br /> | ||
<br /><br /> | <br /><br /> |