Write a function that determines whether any character in a null-terminated character array is a duplicate (a repeated character) and returns the index of the first duplicate character to the caller. If the array contains no duplicate characters the function should return -1. Assume that there may be garbage at the end of the array.