반응형
#include <stdio.h>
#define SIZE 10
int array_equal(int a[], int b[],int size);
int main(void) {
int result = 0;
int a[SIZE] = { 0,1,2,4,5,6,7,8,9 };
int b[SIZE] = { 0,1,2,3,4,5,6,7,8 };
result = array_equal(a,b,SIZE);
if (array_equal(a,b,SIZE) == SIZE)
printf("두 배열이 같습니다.\n");
else
printf("두 배열이 다릅니다.\n");
return 0;
}
int array_equal(int a[], int b[],int size) {
int result = 0;
for (int i = 0; i < size; i++) {
if (a[i] == b[i])
result += 1;
else
result += 0;
return result;
}
}
'프로그래밍 C' 카테고리의 다른 글
쉽게 풀어쓴 C언어 익스프레스 11장 프로그래밍 3번 (0) | 2019.11.14 |
---|---|
쉽게 풀어쓴 C언어 익스프레스 11장 프로그래밍 2번 (0) | 2019.11.14 |
쉽게 풀어쓴 C언어 익스프레스 10장 프로그래밍 4번 (0) | 2019.11.14 |
쉽게 풀어쓴 C언어 익스프레스 프로그래밍 10장 2번 (0) | 2019.11.14 |
쉽게 풀어쓴 C언어 익스프레스 프로그래밍10장 1번 (0) | 2019.11.14 |