c - Big array not causing stack overflow -


i can find plenty of examples of developers complaining big array initialized on stack create stack overflow error

int main(int argc, const char * argv[]) {     int v[100000000];     memset(&v, 0, sizeof(v)); } 

when compiling on apple llvm 7.0, not cause stack overflow, puzzles me array has size of ~400mb, more size of stack.

why above code not cause stack overflow?

since not using v compiler not allocating it, try like

int v[100000000]; (int = 0 ; < sizeof(v) / sizeof(*v) ; ++i)     v[i] = 0; 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -