void randd(int a[]) {
int i;
srand(time(NULL));
for (i = 0; i < 5; i = i + 1) {
a[i] = rand() % 10 + 1;
}
}
int main(void) {
int bayeol[5];
void randd(bayeol);
printf("%d\n %d\n%d\n %d\n", bayeol[0], bayeol[1], bayeol[2],
bayeol[3]);
}
#include
는 선언했습니다.
배열의 각 요소에 10이하의 랜덤한 변수를 할당하는 함수를 나타낸건데, 오류는 나지 않지만, 실행시키면 아무런 변화가 없더라구요. 무엇이 잘못된 건지 궁금합니다.