Home Segments Index Top Previous Next

508: Mainline

If you want to store the appropriate trade-describing string with each new structure object, you need to create a character array to store that description. You cannot just use the input_buffer array, because that array is reused repeatedly, once for each trade-describing string read. Fortunately, you can allocate space for new arrays just as you can allocate space for new structure objects. In fact, you use the same operator, malloc. Thus, the following allocates enough bytes to hold the five characters in the string "C-IBM" plus a terminating null character:

malloc (6)