fork download
  1. #include <stdio.h>
  2. void data_copy(int data[],int *copy,int len){
  3. for(int i=0;i<len;i++){
  4. copy[i]=data[i];
  5. }
  6. }
  7. int main(void) {
  8. // your code goes here
  9. int n1[5]={1,2,3,4,5};
  10. int n2[5]={5};
  11. int len=sizeof(n2)/sizeof(n2[0]);
  12. data_copy(&n1[0],n2,len);
  13. for(int i=0;i<len;i++){
  14. printf("%d\n",n2[i]);
  15. }
  16. return 0;
  17. }
  18.  
Success #stdin #stdout 0.01s 5300KB
stdin
Standard input is empty
stdout
1
2
3
4
5