Im such a stupid Idiot sometimes,.........
Although that might perhaps be the case (i won't be the judge of that), realize that you are not the first (and certainly not he last) and fall for the same pitfalls as everyone else once did.
Also realize that (as shown in my example) using pointers is like driving without an instructor. It gives you lot of freedom but, what you do with that freedom is up to you. Use it wisely :-)
It doesn't matter if your code is shaky or otherwise needs to be kept in the dark but, especially when it comes to pointer arithmatic, be aware that things are very difficult to analyze without seeing some actual code.
Usually we are aware what it is you would like to achieve, and for sure i was not going to suggest using another approach (you wanted to learn about pointers so you can have it your way
).
In hindsight, aren't you glad you shared your code ? It gave you the response you was looking for. Now we wasted a certain amount of posts, and those were initially adding to your frustration (which really is a bad starting point). Which btw does not mean, write a million lines of code, make it buggy and dump the whole lot on the forums with asking "where's Waldo"
Would be really nice when i could get a chance to learn good modelling from developer like you
rvk already did a very good job in explaning what did go wrong in your code
As of how you implemented things: There is no wrong and there is no right. In coding it all depends on what it is used for and what you'd like to do with your implementation. So judging your code would be something for the purists amongst us (i'm usually not one of them).
Truth be told, we have such nice classes/objects that encapsulate linked lists, doubly linked list and the sorts so that we never have to have a close look at those eeky pointers
Perhaps you can have a look in the sources of FPC and see for yourself how some things are implemented/solved ? I certainly learned a lot from that.
"Reading a unit from FPC source-tree a day keeps (embarrassing) questions on the forums away"