TEST/자료구조와 함께 배우는 알고리즘 입문(C언어)
<2> Q9. 자료구조와 함께 배우는 알고리즘 입문 (C언어)
도라몬즈
2020. 6. 28. 22:44
#include <stdio.h>
void ary_copy(int a[], const int b[], int n)
{
int i = 0;
while (n--)
{
a[i++] = b[n];
}
}
int main(void)
{
int a[3];
int b[] = { 1,2,3 };
ary_copy(a, b, 3);
for (int i = 0; i < 3; i++)
printf("a[%d] = %d\n", i, a[i]);
return 0;
}