You set the array pointer to the beginning of the array, and then the while loop loops through until one of the array elements is "0". If the first element was "0" then "array_ptr - array" would be 0 (because they both point to the same place in memory). Therefore, if the second element was 0, array_ptr - array = 1. Ergo, if the seventh element of the array was 0, array_ptr - array = 6.