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. 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), but i've never seen a compiler handle the realloc in an undesireable way (ie you lose the values from your previous malloc). I hope that is clear enough. On Tue, 2006-01-31 at 15:39 -0800, Olwe Bottorff wrote: > Okay, when I use a malloc or alloca, I'm grabbing heap > memory, but if I just initialize a variable, array, > etc. and fill it with stuff, I'm using stack > "automatic" memory, right? But of course a malloc > inside a function uses heap. And in general if you > don't know or have big memory needs, use heap memory, > right? > > > > __________________________________________________ > Do You Yahoo!? > Tired of spam? Yahoo! Mail has the best spam protection around > http://mail.yahoo.com > > _______________________________________________ > TCLUG Mailing List - Minneapolis/St. Paul, Minnesota > tclug-list at mn-linux.org > http://mailman.mn-linux.org/mailman/listinfo/tclug-list