Hmm... I'm definitely doing something wrong here, The f3 function is supposed to return the index of the largest magnitude out of the array of magnitudes ,but when i enter a random N at the beginning it always gives back the N i entered. Also , am I giving the f3 function all the elements of the struct array ( comp ) or just the 1st one???
Here's the modifications i've made:
Code:
int f3(struct Complex comp,unsigned int N)   // Finds largest magnitude, returns index{
    double m[N];
    int i;
    for (i=0; i<N; i++)
    {
        m[i] = f2(comp);        // this is where it needs something else i think
        if(m[0] < m[i])
            m[0] = m[i];
    }


    return i;
}
int main ()
{
    unsigned int N,i;
    struct Complex *comp;
    printf("Enter N:\n");
    scanf("%d",&N);
    comp = (struct Complex*)malloc(N*sizeof(struct Complex));
    if (comp == NULL)
    {
        printf("Error! Out of memory");
        return 1;
    }
      srand ( time ( NULL));
       (*comp).Re = (double)rand()/RAND_MAX*2.0-1.0;   // Randomly generating the real and imaginary parts (from -1 to 1)
       (*comp).Im = (double)rand()/RAND_MAX*2.0-1.0;      
   i = f3(*comp,N);      // Every time im using comp in a function does it take only its first element or all its elements?
   printf("\n\nThe complex number with the largest magnitude :\n");
    f1(*comp);   
    printf("\nIts assigned number in the array:\n  N = %d",i);
    free(comp);


return 0;


}
Thanks for your time