본문 바로가기
프로그래밍 C

쉽게 풀어쓴 C언어 익스프레스 10장 프로그래밍 4번

by MAKING CHA 2020. 1. 7.
반응형

#include <stdio.h>
#define SIZE 10

void array_copy(int a[], int b[], int size);

int main(void) {
int a[] = { 1,2,3,4,5,6,7,8,9,10 };
int b[SIZE] = { 0 };

array_copy(a, b, SIZE);

return 0;
}

void array_copy(int a[], int b[], int size) {

for (int i = 0; i < SIZE; i++) {
printf("%d ", a[i]);
}
printf("\n");
for (int i = 0; i < SIZE; i++) {
b[i] = a[i];
printf("%d ", b[i]);
}

}