check if string in string c
if(strstr(sent, word) != NULL) {
/* ... */
}
check if string in string c
if(strstr(sent, word) != NULL) {
/* ... */
}
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);
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us