the while (curr) line is a little misleading, as it is actually a shorthand. There are two facts you need to know to understand this. First, in C and C++, boolean values (ie true or false) are actually represented by an integer. The number 0 always represents False, but all other numbers represent True. Second, NULL is usually (there is some debate over this, but for now assume always!) shorthand for 0. The result of this is that while (curr) will loop until curr is equal to 0, at which point it will terminate, and since curr is a pointer, it will equal 0 once curr becomes NULL. So basically, the line while (curr) is a slightly sneaky way of saying "While the pointer curr is not NULL".