/* string library functions */ /* 'strstr' searches for a substring in a string */ #include #include int main() { char string1[] = "Computers are electronic machines"; char *str_ptr; printf("Our string is: %s\n", string1); printf("Searching for 'elect' in the string...\n"); str_ptr = strstr(string1, "elect"); if (str_ptr != NULL) printf("%s\n", strstr(string1, "elect")); printf("Now we'll search for 'eletr'...\n"); str_ptr = strstr(string1, "eletr"); if (str_ptr != NULL) printf("%s\n", strstr(string1, "eletr")); }