I'm new to c
int main(int argc,char *argv[]) {
        char *p[1234567] = { NULL };
        return 1;
}
gives Segmentation fault
if I change to 12345, it will work.
I'm new to c
int main(int argc,char *argv[]) {
        char *p[1234567] = { NULL };
        return 1;
}
gives Segmentation fault
if I change to 12345, it will work.
 
    
    Thats most likely because your stack dont have 1234567 * sizeof(char *) bytes of space as needed by variable p
 
    
    An array of 1234567 pointers will be more than 4MB. That is larger than the stack capacity for a thread on many systems. For example, if I recall correctly, on Win32 the address space reserved for a thread's stack defaults to 1MB.
