Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- int main(){
- int a,b,n;
- scanf ("%d",&a);
- scanf ("%d",&b);
- scanf ("%d",&n);
- printf("\n");
- int *ar= GenArray(a,b,n);
- }
- int *GenArray(int a,int b,int n){
- int *ar,i;
- srand(time(NULL));
- for(i=0;i<n;i++){
- if (ar = (int *) malloc(n * sizeof(int))){
- ar[i]= get_rand(a,b);
- printf("%d\n",ar[i]);
- return ar;
- }
- else return NULL;
- }
- }
- int get_rand(int min, int max){
- return rand() % (max - min + 1) + min;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement