 <p>Expand the size of your <code>q1</code> buffer. <code>scanf("%s", q1)</code> doesn't have enough room to store the input. Remember that C uses a null character <code>'\0'</code> to terminate strings. If you don't account for that, the buffer could overrun into other memory causing <a href="https://en.wikipedia.org/wiki/Undefined_behavior" rel="nofollow">undefined behavior</a>. In this instance, it's probably overwriting memory allocated to <code>name</code>, so <code>name</code> ends up pointing to "\0ick". This causes <code>printf(%s)</code>, which looks for <code>'\0'</code> to know when to stop printing, to think that the string is shorter than it really is.</p> <p>The code works perfectly if you expand the buffer:</p> <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;string.h&gt; int main(void) { char name[50]; char q1[50]; printf( " What is your name?\n"); scanf("%49s", name); printf( " Hi %s, Do you want to have some fun? [Y/N]\n",name); scanf("%49s",q1); if(strcmp(q1,"Y") == 0||strcmp(q1,"y")==0) { printf("Awesome, let's play!\n"); } else { printf("Fine"); } printf( "So %s, it's time to get started\n", name); getchar(); return 0; } </code></pre> <p>Output:</p> <pre><code> What is your name? Nick Hi Nick, Do you want to have some fun? [Y/N] y Awesome, let's play! So Nick, it's time to get started </code></pre> <p>Note that I've added the qualifier <code>%49s</code> to avoid buffer overruns like this.</p> <hr> <p>You could also circumvent the need for another string entirely by changing <code>char q1[50]</code> and <code>scanf("%49s")</code> to simply <code>char q1</code> and <code>scanf("%c%*c", &amp;q1)</code> (note the "address of" operator because <code>q1</code> is no longer a pointer).</p> <p>You'll probably even get a performance gain from this (albeit small), because strings are notorious memory hoggers. Comparing a single character is usually preferred over comparing strings.</p> <pre><code>#include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; #include &lt;string.h&gt; int main(void) { char name[50]; char q1; printf( " What is your name?\n"); scanf("%49s%*c", name); printf( " Hi %s, Do you want to have some fun? [Y/N]\n",name); scanf("%c%*c",&amp;q1); if(q1 == 'Y' || q1 == 'y') { printf("Awesome, let's play!\n"); } else { printf("Fine"); } printf( "So %s, it's time to get started\n", name); getchar(); return 0; } if(q1 == 'Y' || q1 == 'y') { printf("Awesome, let's play!\n"); } else { printf("Fine"); } printf( "So %s, it's time to get started\n", name); getchar(); return 0; } </code></pre> <p>If you go this route, you have to ignore the enter key using the format specifier <code>%*c</code> because pressing enter sends a key to the stream as well.</p>