c language function strcpy

strcpy is a function for copying a string

The result of the above procedure is output

Why is the output string is% s s abABC, and outputs the character c s% when it is abABCg

Because of the nature of the function itself strcpy: copy the string until a '\ 0' terminator up, and the copy together with the terminator s ; and thus stored in the memory s is actually abABC \ 0g ; However, due to the characteristics of the output string end of the terminator, so the result is output abABC ; while loop output character is abABCg, s content is stored in real memory.

Guess you like

Origin www.cnblogs.com/shellingfordly/p/11241488.html