include <stdio.h> include <string.h>
int main() { char message = “This is an Important message for everyone”;
if (strstr(message, "Important") != NULL) { printf("The message is important!"); } else { printf("The message is not important!"); } return 0;
}
Example - Checking for Importan in a Message In this example, we’ll use strstr() to check if the word “Important” appears in a message. If it does, we’ll print “The message is important!”, otherwise, we’ll print “The message is not important!”.
When executed, the code will show:
The message is important!