title: Difference between perror() and printf()
body: <p>I had read that both <code>perror()</code> and <code>printf()</code> write to the terminal screen. But <code>perror()</code> writes to <code>stderr</code> while <code>printf()</code> writes to <code>stdout</code>. So, to print errors why is <code>perror()</code> used when <code>printf()</code> can do it.</p>