C Program Time Conversion
<p>I came upon this Time Conversion Program in HackerRank, I was surprised the way how the program is compiled in HackerRank (or could be my misunderstanding of C).</p>

<pre><code>#include &lt;stdio.h&gt;

int main() {
    int hh, mm, ss;
    char tt[2];
    scanf("%d:%d:%d%s", &amp;hh, &amp;mm, &amp;ss, tt);
    printf("%d\n", hh);
    if(strcmp(tt, "PM") == 0 &amp;&amp; hh != 12) hh += 12;
    if(strcmp(tt, "AM") == 0 &amp;&amp; hh == 12) hh = 0;
    printf("%02d:%02d:%02d", hh, mm, ss);
    return 0;
}
</code></pre>

<p>The above program, when I ran in my computer, using MinGW 32-bit GCC Compiler, I was getting the value of hh as zero.</p>

<p><a href="https://i.stack.imgur.com/wexI0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wexI0.jpg" alt="enter image description here"></a></p>

<p>Fine, I thought could be compiler issue and ran the code in IDEONE, same results.</p>

<p><a href="https://i.stack.imgur.com/IlhLC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IlhLC.jpg" alt="enter image description here"></a></p>

<p>But when I ran this same code with HackerRank, all testcases were passed, I have no idea, how this is working here?</p>

<p><a href="https://i.stack.imgur.com/uKw5u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uKw5u.png" alt="enter image description here"></a></p>

<p>I am confused at this stage, am I doing this right?</p>