Stack size


How is the stack size determined? if the stack ran out of room for additional functions would the stack automatically take more memory from the heap or would the program just crash?

I also dont understand why you would use malloc() to claim space from the heap for a struct. Because when using structs before I never used malloc() so was the struct created in a functions frame on the stack?


The stack size is 8 MB by default: … index.html

Yes, if you didn’t malloc the struct, it was allocated on the stack. (I mean, unless some function was calling malloc for you.)


OK Thanks :slight_smile: