Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*****************************************************************************
- *Robert Taracha
- *Connect.c
- *****************************************************************************/
- #include <stdio.h>
- #include <stdlib.h>
- /********************************
- int numRandom(int min, int max);
- ***********************************/
- int main(void) {
- int max = 10, min = 0;
- int count = 0;
- static int p[10];
- static int q[10];
- int *tempp, *tempq;
- int test = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
- int *i ;
- printf("filling both arrays");
- /* fill p and q */
- for(count;count < max;count++){
- p[count] = numRandom(min, (max - 1));
- q[count] = numRandom(min, (max - 1));
- }
- for(count = 0;count < max;count++){
- tempp = (int) p[count];
- tempq = (int) q[count];
- if(test[tempp] != test[tempq]){
- test[tempp] = test[tempq];
- }
- printf("%d", test[count]);
- i++;
- }
- prtinf("Finshed");
- return 0;
- }
- /*********************************************/
- int numRandom(int min, int max) {
- return rand() % (max - min + 1) + min;
- }
- /*************************************************/
- ~
- ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement