Well, if you think that, don't help me! In reality I'm a new grad student who never really learned any of this stuff before (in my 15+ years of database and Web programming), but who now is expected to run labs on it. Actually the previously prepared labs I was handed were much duller, simpler, rote, but I insist on giving the students more. These questions I ask are for an OS course and an intro Sys Programming class. My university is not a top university, but I'm struggling to learn, and struggling to present this material to my students. I'm already 50 years old, but I came back to grad school because I want to learn--and to get out of the Dilbert scene which is all I've really known in the working computer world. So, again, take it or leave it! If I don't get answers from TCLUG, I'll just go somewhere else to build up my knowledge bank. BTW, I'm taking classes in Programming Languages (Robert Sebesta) and Algorithms (Thomas Corman, et.al.), so if I ask any questions about these subjects, yes, I'm cheating, don't answer them! Olwe --- Florin Iucha <florin at iucha.net> wrote: > On Tue, Jan 31, 2006 at 11:07:07PM -0600, Larry > Tordsen wrote: > > Basically, you use malloc when you dont know how > big of an area of > > memory you need. The compiler allots some memory > for your program when > > it is compiled. If your program steps over the > boundry, you get your > > friendly 'segmentation fault' error. > > If you step over the boundary of your heap, you get > the segmentation > fault exception. > > > You can use > realloc to reallocate > > your array if you approach the size of your > initial region. I think > > posix says the contents are indeterminate (its > changed between c89 and > > c99), > > Nope, it is not changing. The pointer you use to > access the object > might change, but the old contents will be moved: > > http://www.opengroup.org/onlinepubs/007908799/xsh/realloc.html > > (This is SuSv2 but my book on SuSv3 has an identical > entry on > realloc.) > > > but i've never seen a compiler handle the > realloc in an > > undesireable way (ie you lose the values from your > previous malloc). > > It is a library function, part of the UNIX API, not > a compiler intrinsic. > That's why it is specified by Posix/SuS and not by > c89/c99. > > florin > > > I hope that is clear enough. > > -- > Don't question authority: they don't know either! > > _______________________________________________ > TCLUG Mailing List - Minneapolis/St. Paul, Minnesota > tclug-list at mn-linux.org > http://mailman.mn-linux.org/mailman/listinfo/tclug-list > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com