#include <stdio.h>
#include <stdlib.h>
#define LEN 10
int length = 0;
int arr[LEN];
int main(){
int arr[LEN];int length = 0;int num;
for(int i=0;i<=length;i++){
//生成一个随机数组
int num = arc4random_uniform(10);
//判断这个随机数
if(arr[i]==num){
continue;
}
arr[length++] = num;
}
for (int i=0;i<length;i++){
printf("arr[%d] = %d\n",i,arr[i]);
}
}
|
|