본문 바로가기

프로그래밍 C13

쉽게 풀어쓴 C언어 익스프레스 11장 프로그래밍 4번 #include #define SIZE 10 void array_printf(int *A, int size) { int i; printf("A[] = { "); for (i = 0; i 2019. 11. 14.
쉽게 풀어쓴 C언어 익스프레스 11장 프로그래밍 3번 #include #include #include #define SIZE 10 void array_fill(int *A, int size); int main(void) { int A[SIZE] = { 0 }; array_fill(A, SIZE); } void array_fill(int *A, int size) { int i; srand((unsigned)time(NULL)); for (i = 0; i 2019. 11. 14.
쉽게 풀어쓴 C언어 익스프레스 11장 프로그래밍 2번 #include void get_sum_diff(int x, int y, int *p_sum, int *p_diff); int main(void) { int sum = 0; int diff = 0; int x = 10; int y = 35; get_sum_diff(x, y, &sum, &diff); printf("x=%d y=%d\n", x, y); printf("두 수 x,y의 합: %d\n", sum); printf("두 수 x,y의 합: %d\n", diff); return 0; } void get_sum_diff(int x, int y, int *p_sum, int *p_diff) { *p_sum = x + y; *p_diff = x - y; return; } 2019. 11. 14.
쉽게 풀어쓴 C언어 익스프레스 10장 프로그래밍 4번 #include #define SIZE 10 int array_copy(int a[], int b[], int size); int main(void) { int a[SIZE] = { 1,2,3,4,5,6,7,8,9 }; 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 2019. 11. 14.
쉽게 풀어쓴 C언어 익스프레스 프로그래밍 10장 3번 #include #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 2019. 11. 14.
쉽게 풀어쓴 C언어 익스프레스 프로그래밍 10장 2번 #include #include #include int main(void) { int x[10] = { 0 }; int minimum, maximum; srand((unsigned)time(NULL)); for (int i = 0; i 2019. 11. 14.
반응형