Quote Originally Posted by AvaGodess View Post
I know at that point it has basically nothing. But arent I feeding it some data in this part
Code:
for ( i = 0; i < SIZE; i++ )
      array[ i ] = rand() % 90 + 10; /* give each element a value */
       
   printf( "Unsorted array:\n" );
    
   for ( i = 0; i < SIZE; i++ ) /* print the array */
      printf( "%d  ", array[ i ] );
I'm just asking for some help thats all, how could this little program be settled. Without doing what you say. Basically i wanted to make copies of the elements given to the array, and work with them in the function.
Yes, but that is AFTER you called strcpy(). My point was that if we assume that you replace strcpy() with something that actually copies array into copy, it would still contain garbage, since array has NOT YET been filled with something - it contains whatever happens to be in that location of memory [1], and it's very unlikely that this matches your random number sequence.

[1] Some compilers will actually fill unused memory with a recognisable pattern so that we can "see" that the memory has not been filled in, but the content is still not what you would like to have, so it's pretty irrelevant really.

--
Mats