for example,
char pass[0x10];
char str1[0x10] = "hello";
strcpy(string1, str1)
Does this copy 1 * 5 bytes, plus 1 more bytes of the \0 null terminator? So 6?
Im pretty new to low level, so I'm struggling to understand the Bytes concept.
strcpy
:
Copies the null-terminated byte string pointed to by
src
, including the null terminator, to the character array whose first element is pointed to bydest
.
"hello"
is a string of 6 characters as in C, a string includes the null character.
"string is a contiguous sequence of characters terminated by and including the first null character." C17 § 7.1.1.1
All 6 are copied with strcpy()
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.