How to check if the substring is present in a string with C

1 Answer

0 votes
#include <stdio.h>
#include <string.h>

int main() {
    char s[] = "c programming";
     
    if (strstr(s, "gra")) {
        puts("Present");
    }
    else {
        puts("Not present");
    }
 
    return 0;
}
         
        
        
         
/*
run:
          
Present
     
*/

 



answered Jan 19, 2021 by avibootz
...