Pointers admission for LinkedList functions
- Psychophanta
- Always Here

- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact:
-
PolyVector
- Enthusiast

- Posts: 499
- Joined: Wed Sep 17, 2003 9:17 pm
- Location: Southern California
- Contact:
Hey Psychophanta, I believe you are wrong about my example being redundant... The linked list internally uses the *Next and *Previous pointers...
If you'll notice, I never assign a value to *Next or *Previous... This is done internally by PureBasic...
It can be proven...
This Code Works:
It does NOT work if you change the Structure to this:
If I were just creating duplicate pointers it wouldn't matter what order they occured in the structure...
anyways... Let's stop going on about this because we both agree that better internal support is needed...
On to the Osama jokes:
If you'll notice, I never assign a value to *Next or *Previous... This is done internally by PureBasic...
It can be proven...
This Code Works:
Code: Select all
Structure LinkedString
*Next.LinkedString
*Previous.LinkedString
value.s
EndStructure
NewList Hello1.LinkedString()
NewList Hello2.LinkedString()
*ptr.LinkedString
*ptr=AddElement(Hello1())
*ptr\value = "Hello1, Item One"
*ptr=AddElement(Hello1())
*ptr\value = "Hello1, Item Two"
*ptr=AddElement(Hello1())
*ptr\value = "Hello1, Item Three"
Procedure PrintListContents(*ptr.LinkedString)
Repeat
If *ptr
Debug *ptr\value
EndIf
*ptr=*ptr\Next
Until *ptr=0
EndProcedure
PrintListContents(FirstElement(Hello1()))
Code: Select all
Structure LinkedString ;Notice that *Next and *Previous are reversed
*Previous.LinkedString
*Next.LinkedString
value.s
EndStructure
anyways... Let's stop going on about this because we both agree that better internal support is needed...
On to the Osama jokes:
Last edited by PolyVector on Thu Oct 02, 2003 6:43 pm, edited 2 times in total.
- Psychophanta
- Always Here

- Posts: 5153
- Joined: Wed Jun 11, 2003 9:33 pm
- Location: Anare
- Contact: