안녕하세요, 사용자 입력을 요구하지 않고 randnumber를 저장하는 방법이 있는지 알고 싶습니다.C 난수 배열 배열
#include<stdio.h>
#include<stdlib.h>
void main() {
int randnum;
int i=0;
int storerand[16]; // storing randnumbers
randnum=rand();
while(i <16){
storerand[i]=randnum; // why is this not storing 16 rand number how can i store 16 randnumbers
i++;
}
return 0;
귀하의 루프 카운터'i' 코드에서 어디 증가 할 나타나지 않습니다. 루프에 대해 이것이 무엇을 의미한다고 생각하십니까? – Arc676
16 개의 값이 정확히 같은 난수가되도록 하시겠습니까? 아니면 각 슬롯마다 새로운 난수를 생성 하시겠습니까? – paddy
@paddy 다른 숫자 일 수 있습니다. –