• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
linked list problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

linked list problem


  • Subject: linked list problem
  • From: Nick Rogers <email@hidden>
  • Date: Tue, 1 Apr 2008 03:01:39 +0530

Hi,
I have the following singly linked list:

typedef struct Dir
{
// some space to hold data here
void *next; // have to take void * here cause Dir* leads to compile error
}DIR;


In my code:

DIR *temp = parentDir; //parentDir is allocated initially but its next is not allocated at this point
while (temp)
{
temp = (DIR*)temp->next; //here next is null so, temp now is null
}
temp = newDir; //here newDir is already allocated, but temp doesn't get allocated, in a way parentDir->next remains null.



While this type of code works fine on VS2005, it doesn't wprk here in cocoa.
How else can I reach the end of the list and add a new node?


Please help.

Thanks,
Nick
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: linked list problem
      • From: "stephen joseph butler" <email@hidden>
  • Prev by Date: Re: libpq prepared statement
  • Next by Date: Re: Threads and Core Data, bindings results in view corruption
  • Previous by thread: remote debugging between ppc & intel
  • Next by thread: Re: linked list problem
  • Index(es):
    • Date
    • Thread