Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <math.h>
- #define SIZE 20
- //populate an array of given SIZE with unique numbers from 0 to SIZE-1.use rand()
- void pop_arr(int *,int);
- void pr_arr(int *, int);
- void is_it_repeat(int *,int,int);
- int main()
- {
- int arr[SIZE];
- pop_arr(arr,SIZE);
- pr_arr(arr,SIZE);
- return 0;
- }
- void pr_arr(int *a,int s)
- {
- int i;
- for(i=0;i<s;i++)
- printf("%d\t",a[i]);
- printf("\n");
- }
- void pop_arr(int *a,int s)
- {
- int i,j,counter=0;
- for(i=0;i<s;i++)
- {
- printf("counter %d\n",counter);
- counter++;
- a[i] = rand()%SIZE;
- printf("\nvalue %d\t",a[i]);
- {
- for(j=0;j<=i-1;j++)//here suppose to start function
- {
- if(a[i]==a[j])
- j = i,i--,printf("try once more!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement