Question: Consider the following code. char *findSubstring(char *str, char *needle) { int len = strlen(needle); int n = 0; while (*str) { printf(%c%c ,*str, *(needle+n)); if

Consider the following code.

char *findSubstring(char *str, char *needle) { int len = strlen(needle); int n = 0; while (*str) { printf("%c%c ",*str, *(needle+n)); if ( *(needle+n) == *str) { n++; if (n == len) return (str-len)+1; } else { str -= n; n = 0; } str++; } return NULL; }

What is the output of findSubstring("ACDCDEF","CDE")?

Group of answer choices

AC CC DC CC DC CC DC EC

AC CC DC CC DC CC DD EE

AC CC DD CE DE CE DE EE

AC CC DD CE DC CC DD EC

AC CC DD CE DC CC DD EE

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!