[C] copy a table

Solved
limbergh Posted messages 669 Status Member -  
fiddy Posted messages 441 Registration date   Status Contributor Last intervention   -
Hello,

I have code with functions, the goal is to fill an array with numbers, then display it,... and finally
copy it to another array.
I don't know how to do it, I tried with a function and it doesn't work.

If anyone has an explanation...
Thank you in advance
Configuration: Windows XP Firefox 2.0.0.11

13 answers

OrionS Posted messages 55 Status Member 39
 
You can use the memcpy() function
 #include <string.h> int Tab1[10], Tab2[10]; memcpy(Tab2, Tab1, sizeof Tab2); </string.h>
26
Nooka
 
Wow! Thank you for your response, memcpy is not only convenient but also extremely fast compared to creating a for loop. I'm working on DS programming, and this function has saved my life XD (since the console isn't a calculation beast, it's a much-appreciated time saver).
0