Answers for "check if string contains substring c"

C
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 %p\n", 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 substring c"

Code answers related to "C"

Browse Popular Code Answers by Language