You cannot do that in C. What you're doing here is checking identity equality (id est if your two pointers point the same memory zone).
What you can do is use libc strstr that does what you want :
#include <string.h>
if (strstr(test, "yup this is the sentence") != NULL)
{
// do stuff if test contains the sentence
}
Type man 3 strstr in a terminal to get more info about the function, and all its behaviours.
If you want to understand the behaviour of the function, here it is recoded in pure C, with one loop only :
char *strstr(const char *s1, const char *s2)
{
int begin;
int current;
begin = 0;
current = 0;
if (!*s2)
return ((char *)s1);
while (s1[begin])
{
if (s1[begin + current] == s2[current])
current++;
else
{
current = 0;
begin++;
}
if (!s2[current])
return ((char *)s1 + begin);
}
return (0);
}
It is part from a school project. The full project contains all the C library basic functions.
You can check out some other string manipulation functions here :
https://github.com/kube/libft/tree/master/src/strings