Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- ////////////////
- struct TT
- {
- int n;
- int *p;
- char c; // 'N' = признак наличия отрицательных чисел
- };
- TT t1, t2, tArr[88];
- void Create_Arr(int);
- void Monitor_Arr();
- //////////////////////////////////////////////
- int main() //
- {
- t1.c = 'N';
- Create_Arr(17);
- //int *px = t1.p;
- Monitor_Arr();
- return 0;
- }
- /////////////////////////////////////////////
- void Monitor_Arr() //
- {
- for(int i = 0; i < t1.n; i++)
- {
- printf("%d, ", t1.p[i]);
- } printf("\n");
- }
- /////////////////////////////////////////////
- void Create_Arr(int n1) //
- {
- srand(time(0));
- int *p1 = (int*)malloc(n1 * sizeof(int));
- t1.p = p1;
- t1.n = n1;
- for(int i = 0; i < n1; i++)
- {
- p1[i] = rand()%300;
- if(t1.c == 'N') p1[i] = p1[i] - 150;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement