Home Segments Index Top Previous Next

616: Mainline

If you want to store the appropriate serial number with each new class object, you need to create a character array to store that number. You cannot just use the input_buffer array, because that array is reused repeatedly, once for each number read. Fortunately, you can create new arrays just as you can create new class objects. In fact, you use the same operator, new. Thus, the following creates a new array that is just long enough to hold the nine characters in a serial number plus a terminating null character:

new char[10]