Typically, querying an array to determine how many elements it contains involves using the sizeof operator, often wrapped in COUNTOF macro. But what happens when COUNTOF gets something it wasn't expecting? The results may surprise you. There is, however, a way to make COUNTOF type-safe. Ivan Johnson shows the way in "Counting Array Elements at Compile Time."