1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #include <stdlib.h> #define SIZE 1000 int main(void) { int *p = NULL; int i = 0; p = (int *)malloc(SIZE * sizeof(int)); if (p == NULL) { printf("¸Þ¸ð¸® ÇÒ´ç ¿À·ù\n"); exit(1); } for (i = 0; i < SIZE; i++) p[i] = rand(); int max = p[0]; for (i = 1; i < SIZE; i++) { if (p[i] > max) max = p[i]; } printf("ÃÖ´ë°ª=%d \n", max); free(p); return 0; } | cs |