Re: dynamic arrays ...problems creating them

Discussion in 'C Programming' started by Tom St Denis, Jul 3, 2003.

  1. Tom St Denis

    Tom St Denis Guest

    ram wrote:
    > I have a link list having n nodes of type struct cq
    >
    > I want to create an array of pointers to each node and then pass this
    > array to the qsort function
    >
    > cq *l,*array;
    >
    > array=(cq *)malloc(length*sizeof(cq));
    >
    > i=0;
    > for (l=chd; l; l=l->next)
    > array[i++]=l; // I get an error here
    > incompatible types in assignment


    What type are array, array and l?

    Tom
    Tom St Denis, Jul 3, 2003
    #1
    1. Advertising

  2. Tom St Denis

    ram Guest

    >
    > What type are array, array and l?
    >
    > Tom


    they are of type 'struct cq'
    i have declared them as pointers to cq

    think i solved the problem
    should have been
    array[i++]=&l
    ram, Jul 3, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anonieko

    HttpHandlers - Learn Them. Use Them.

    Anonieko, Jun 15, 2006, in forum: ASP .Net
    Replies:
    5
    Views:
    516
    tdavisjr
    Jun 16, 2006
  2. Marco de Boer

    Re: dynamic arrays ...problems creating them

    Marco de Boer, Jul 3, 2003, in forum: C Programming
    Replies:
    0
    Views:
    745
    Marco de Boer
    Jul 3, 2003
  3. monkeydragon

    Creating Dynamic 2D Arrays

    monkeydragon, Dec 15, 2005, in forum: C++
    Replies:
    2
    Views:
    337
    Axter
    Dec 15, 2005
  4. Philipp
    Replies:
    21
    Views:
    1,126
    Philipp
    Jan 20, 2009
  5. why the lucky stiff
    Replies:
    5
    Views:
    143
    why the lucky stiff
    Sep 22, 2004
Loading...

Share This Page