#Structure woes
17-Apr-93 01:58:10
Sb: #34259-#Structure woes
Fm: Michael A McCormick 76046,1057
To: Deryk Robosson 76124,1426
That's what I do, malloc and link. If it's a linear linked list instead of a
circular one, make *sure* to set the pointers at each end to NULL and to
*check* for NULL *every* time you move along the list. If I emphasized each
word in this message it still wouldn't equal the number of times I've crashed
my machines by not doing that and by making assumptions.
Heres a line or two of code:
if ( !(bufptr = (Buffer *) malloc( sizeof( Buffer ) )) )
{ printf( "Memory problem\n" ); /* error handling here */ }
Next week, we'll do recursion.
Mike McCormick