Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Re: dynamic arrays ...problems creating them

Thread Tools

Re: dynamic arrays ...problems creating them

Marco de Boer
Posts: n/a
Hi ram,
"ram" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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;

You want a pointer to an array of cq pointers : cq **array.

> array=(cq *)malloc(length*sizeof(cq));

You only want to store nItem pointers:

> i=0;
> for (l=chd; l; l=l->next)
> array[i++]=l; // I get an error here
> incompatible types in assignment
> Why??
> Thanks for the help

Don't forget to free the array !!!


Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Multidimensional arrays and arrays of arrays Philipp Java 21 01-20-2009 08:33 AM
Compacting 5,000 Messages, Moving Them To A Google Account, And Burning Them Onto A CD Martin Computer Support 9 01-14-2007 09:33 PM
HttpHandlers - Learn Them. Use Them. Anonieko ASP .Net 5 06-16-2006 06:19 PM
Does anyone know them or has any experience with them (good or bad)? Mike Timbell Digital Photography 9 11-13-2003 01:09 AM
Re: dynamic arrays ...problems creating them Tom St Denis C Programming 1 07-03-2003 06:01 PM