Cracking The Coding Interview/Q 12.1

From Software Engineers Wiki
Jump to: navigation, search

Find the mistake(s) in the following code:

unsigned int i;
for (i = 190; i >= 0; --i)
    printf("%d\n", i);

Answer

unsigned integer is always equal to or greater than 0. So above loop never exits.

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox