|
Thanks Joel and all the rest who responded. This is what I needed, I have done linked lists in the past with C but that has been a few years ago and I have not even tried for a few years this should give me a good start... I put this code in and it works like a champ.... The only other question I have is when I Dealloc do I do it on each entry of the list or or do I just dealloc First. I would think I need to do it on each entry to clear the space. The reason I ask is after the list is created and used the user does not exit the (interactive) program just needs to print another document so I do not want to be eating up space unnecessarily.. Joel Fritz <JFritz@sharperim To: "'rpg400-l@midrange.com'" <rpg400-l@midrange.com> age.com> cc: Sent by: Subject: RE: Help a pointer Newbie out... rpg400-l-admin@mi drange.com 01/08/2002 03:09 PM Please respond to rpg400-l H dftactgrp(*no) actgrp(*caller) H OPTION( *SrcStmt: *NoDebugIO) Dlink ds based(curr ) Ddata 5p 0 Dnext * D D first s * D D sizeoflink s 5u 0 inz(%size(link)) D curr s * D x s 5u 0 c* Create the list C alloc sizeoflink first C eval curr = first C eval data = 1 C C* add 9 more elements C for x = 2 to 10 C alloc sizeoflink next C eval curr = next C eval data = x C eval next = *null C endfor C C* traverse the list C eval curr = first C dow next <> *null C eval curr = next C enddo C eval *inlr = *on
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.