[Updated] Goldman Sachs Aptitude Test Questions and Answers
Practice List of TCS Digital Coding Questions !!!
Take 50+ FREE!! Online Data Interpretation Mock test to crack any Exams.
Interview Questions and Answers :: Cisco

6. What is difference in memcpy, strncpy.

Answer:

a) When memory block requires to be copied then memcpy is useful

when data in the form of string need to be copied then strncpy is useful because of the natural advantage of '\0' terminated string.

b) memcpy() can copy data with embedded null characters.

strncpy will copy the string to the maximum of either the number of characters given or the position of the first occurrence of null character, i.e '\0' , and reset will be filled with 0

Post Your Answer Here:      Public      Private

Rate This: +2 -0
Report     

Post Your Reply Here:     

Report Error

Report Error

Please Login First Click Here