Reading time as character array in c
<p>I am a newbie to C character arrays. And I know that to read character arrays we need to use %s format specifier using scanf or gets.</p>

<p>I am reading time as two character array's in C as h[2] and m[2] where h represents hours and m represents minutes.</p>

<pre><code>char h[2],m[2];
scanf("%s:%s",h,m);

printf("%s:%s",h,m);
</code></pre>

<p>But when I give <code>11:30</code> as input it prints time as <code>11:30::30</code> as output. Can anyone say me the reason?</p>

<p>Thank you.</p>