Answers for "check if string contains character c"

C
2

check if string in string c

if(strstr(sent, word) != NULL) {
    /* ... */
}
Posted by: Guest on February-23-2020
0

check if string contains substring c

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

const char *tmp = "This string literal is arbitrary";

int main(int argc, char *argv[]){
    char *ret;

    ret = strstr(tmp, "literal");
    if (ret)
        printf("found substring at address %pn", ret);
    else
        printf("no substring found!n");

    exit(EXIT_SUCCESS);
}
Posted by: Guest on October-07-2021

Code answers related to "check if string contains character c"

Code answers related to "C"

Browse Popular Code Answers by Language