Check if the string contains another string in C language

www‮iruttual.‬.com
Check if the string contains another string in C language

the string contains substring or not

// C language example: check if string in another string in C

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <stdbool.h>

int main(int argc, char *argv[]) {
  char mystring[] = "Hi,lautturi world.";
  char findme[] = "lautturi";

  if(strstr(mystring, findme) != NULL) {
      
    printf("The string '%s' was found in the string '%s' ",findme,mystring);
  }

  return 0;
}
Created Time:2017-08-28 11:46:41  Author:lautturi