What is the significant difference between memcpy()
and strncpy()
? I ask this because we can easily alter strncpy()
to copy any type of da
Take for example these numbers in your array:
brr[2]={512,44};
The least significant byte of the first number brr[0]
is 0
(512
is 0x200
) which would causes 1) strncpy
to stop copying. strncpy
does not copy characters that follow a null
character.
1) To be pedantic (see comments), this holds provided that the implementation has sizeof (int) > 1
.