int n, array[1000], c, d, t; printf("Enter number of elements\n"); scanf("%d", &n);
the compiler is allocating 4000 bytes in the stack , then the program asks the user how many elements he wants..
instead of that , it's better to ask the user how many elements he wants first ( upper-bounded ) , do dynamic memory allocation on the heap segement using standard library function void * malloc( size_t memorySize );
int n, array[1000], c, d, t; printf("Enter number of elements\n"); scanf("%d", &n);
the compiler is allocating 4000 bytes in the stack , then the program asks the user how many elements he wants.. instead of that , it's better to ask the user how many elements he wants first ( upper-bounded ) , do dynamic memory allocation on the heap segement using standard library function
void * malloc( size_t memorySize );