I'm trying to write a program that will allow the user to input up to 1000 numbers in a one dimensional array.
How would I be able to have the user stop the array when they've entered the amount of numbers that they needed to enter. Right now it continues until 1000 numbers have been entered.Code:/*Function that loads the array* /void loadArray(int a[]){ int i; for (i = 0; i < ASIZE; i++) { printf("Enter up to 1000 numbers: "); scanf("%i", &a[i]); } return; }
Thank you so much!
I found the answer online!
Code:printf("Enter the number of elements in array\n"); scanf("%d",&size); printf("Enter %d integers\n", size); for ( c = 0 ; c < size ; c++ ) scanf("%d", &array[c]);



LinkBack URL
About LinkBacks



