For the second array (which you will use for finding the circumference), one of the major problems is that you could "bump" into the side of the picture when scanning for your next move. This could present a signficant challenge in figuring out the logic for the exceptions! However, here is a nifty trick: Put a "Frame" around the entire array of one extra position, all filled with blanks. Therefore, as you scan you CANNOT compute an illegal position! Thus, in your original array, you might use rows 1 through 24, and not use row 0. You might use columns 1 - 79 and not use column 0. This could be defined as:
titan = new char;
and your new array would be:
titan_scan = new char;
where you would use fill row 0, column 0, row 25 and column 80 with blanks.