Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - C language problem: The teacher said that the array does not support the whole input and output. Why can this code? (Format control character is %s)
C language problem: The teacher said that the array does not support the whole input and output. Why can this code? (Format control character is %s)
Character array is the only array type in C that can be directly output as a whole, and %s must be used to control characters here. To output a character array with %s, you need to mark the end of the string with' \0' characters, otherwise it will be output all the time, including the parts outside the array, which are garbled.