What is the difference between strcpy() and memcpy() function in c programming?



What is the difference between strcpy() and memcpy() function in c programming?..

Answer / Shreekant Gupta

"strcpy" copies the string pointed to by src, including the terminating null character (), to the array pointed to by dest. It also adjusts the value of the pointer passed as the destination (dest). On the other hand, "memcpy" copies a specified number of contiguous bytes from the memory area pointed to by src to the memory area pointed to by dest. It does not adjust pointers.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

How to get string length of given string in c?

1 Answers  


Hi can anyone tell what is a start up code?

1 Answers   CTS,


what is y value of the code if input x=10 y=5; if (x==10) else if(x==9) elae y=8; a.9 b.8 c.6 d.7

4 Answers   TCS,


the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above

1 Answers  


int main() { int x = (2,3,4); int y = 9,10,11; printf("%d %d",x,y); } what would be the output?

7 Answers   Parimal, Wipro,


C program to find frequency of each character in a text file?

6 Answers  


Explain indirection?

1 Answers  


I have a function which accepts, and is supposed to initialize,a pointer, but the pointer in the caller remains unchanged.

1 Answers  


Why is C language being considered a middle level language?

1 Answers  


In the following control structure which is faster? 1.Switch 2.If-else and which consumes more memory?

4 Answers  


What is the g value paradox?

1 Answers  


Explain how do you convert strings to numbers in c?

1 Answers  


Categories