![]() |
![]() |
![]() |
![]() |
![]() |
|
Finally, you
copy the trade description into the new character array using
strcpy, for string copy, another function
from the string library. Note that the target array is the first
argument and the source array is the second:
strcpy (trade_pointers[limit] -> description, input_buffer);
The effect of strcpy is to copy the trade description from the
input_buffer array, which has to be large enough for trade
descriptions of any conceivable length, into a new character array that is
just big enough to hold the trade description actually observed:
input_buffer Null character | | v v *---*---*---*---*---*---*---*---*---*---*---*---*-- | C | - | I | B | M | | | | | | | | *---*---*---*---*---*---*---*---*---*---*---*---*--- | | | | | | | | | | | | <-- Copy operation v v v v v v *---*---*---*---*---*---* | C | - | I | B | M | | *---*---*---*---*---*---* ^ | trade_pointers[limit] -> description