27.10.2014 Views

Cracking the Coding Interview, 4 Edition - 150 Programming Interview Questions and Solutions

Cracking the Coding Interview, 4 Edition - 150 Programming Interview Questions and Solutions

Cracking the Coding Interview, 4 Edition - 150 Programming Interview Questions and Solutions

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Solutions</strong> to Chapter 12 | Testing<br />

12.1 Find <strong>the</strong> mistake(s) in <strong>the</strong> following code:<br />

1 unsigned int i;<br />

2 for (i = 100; i 0”.<br />

1 unsigned int i;<br />

2 for (i = 100; i > 0; --i)<br />

3 printf(“%d\n”, i);<br />

One additional correction is to use %u in place of %d, as we are printing unsigned int.<br />

1 unsigned int i;<br />

2 for (i = 100; i > 0; --i)<br />

3 printf(“%u\n”, i);<br />

2 0 9<br />

<strong>Cracking</strong> <strong>the</strong> <strong>Coding</strong> <strong>Interview</strong> | Concepts <strong>and</strong> Algorithms

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!