PublicChar*Random_num () {int*a,n=8, I,j; Char*p = (Char*)malloc(sizeof(Char)*9); Memset (P,0,sizeof(p)); A= (int*)calloc(N,sizeof(int)); for(i=0; i<n;i++) {Loop:a[i]= rand ()%Ten; for(j=0; j<i;j++) if(A[i] = = A[j])GotoLoop; } sprintf (P,"%d%d%d%d%d%d%d%d", a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]); returnp;} PublicChar* Str_digit (intN) { inti; Char*sran =NULL; Char(*p) [9]; P= (Char(*) [9])malloc(sizeof(Char) *n*9); Srand (Time (NULL)); for(i=0; i<n;i++) {Sran=Random_num (); memcpy (P[i],sran,9); } Sran=NULL; return(Char*) p;} PublicChar* Digit (intN) { Char(*s) [9] =NULL; s= (Char(*) [9]) str_digit (n); Char*result =NULL; result= (Char*)malloc(sizeof(Char)* -); memset (Result,0,sizeof(result)); inti; for(i=0; i<n;i++) {sprintf (Result+i*9,"%s", S[i]); } result[strlen (Result)-1] =' /'; returnresult;}
Random number generation (the main practice of using array pointers)