 <p>Since you're allocating a char array but do not initialize it, <code>strlen()</code> will count from the beginning of the <code>tab</code> pointer to the first NUL character. So the result depends on the contents of your program's heap.</p>