Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void bug(int a[], int n, int b[],int g,int c)
- {
- int r = 0;
- int *ptr=&a[n];
- for (int i = 0; i < n;i++)
- {
- a[i] = rand() % 90 + 10;
- printf("%d ", a[i]);
- }
- printf("\n");
- for (int i = 0; i < g; i++)
- {
- b[i] = rand() % 90 + 10;
- printf("%d ", a[i]);
- }
- printf("\n");
- *a = (int)realloc(a, sizeof(int)*n+g);
- for (int i = 0; i < c; i++)
- {
- a[i]=a[i];
- }
- for (int i = c; i < (c+g); i++)
- {
- a[i] = b[r++];
- }
- for (int i = (c+g); i < (n + g); i++)
- {
- a[i]=a[n+g--];
- }
- for (int i = 0; i < (n + g); i++)
- {
- printf("%d ", a[i]);
- }
- }
- void kolos1()
- {
- int c;
- int g;
- int *a;
- int b[5];
- int n=20;
- a = (int*)malloc(sizeof(int)*n);
- bug(a, n,b,5,10);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement