 <p>If it's not a student assignment and you truly are using C++(as your tag says) you should use <em>strings</em>. Now you're using arrays and comparing arrays addresses instead of real strings. In a C++ way your code might look like: </p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; int main() { std::string a ="wasd"; std::string b ="asd"; if(a.substr(1) == b) std::cout &lt;&lt; "Yes!\n"; } </code></pre> <p>Well, there is a better way to find if one string contains another but the code is a direct mapping of your C code to the C++-ish one.</p>