You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 );
The text was updated successfully, but these errors were encountered:
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 );
The text was updated successfully, but these errors were encountered: