lgbasallote
  • lgbasallote
C array help
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
SOLVED
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
chestercat
  • chestercat
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
lgbasallote
  • lgbasallote
i have this code ``` #include #include main() { int a[100]; int b, c, d; printf("How many numbers do you want? "); scanf("%d", &c); for (b=1; b<=c; b++) { printf("\nEnter number %d: ", b); scanf("%d", d); } getch(); } ``` how can i make the program print the inputted numbers in a form of a list?
anonymous
  • anonymous
#include #include main() { int a[100]; int b, c, d[c]; printf("How many numbers do you want? "); scanf("%d", &c); for (b=1; b<=c; b++) { printf("\nEnter number %d: ", b); scanf("%d", d[b]); } getch(); } may be this can be helpful
anonymous
  • anonymous
#include #include main() { int a[100]; int b, c; printf("How many numbers do you want? "); scanf("%d", &c); for (b=1; b<=c; b++) { printf("\nEnter number"); scanf("%d", &a[c]); } getch(); }

Looking for something else?

Not the answer you are looking for? Search for more explanations.

More answers

anonymous
  • anonymous
The &a[c] lets you give an input of c numbers If you want to display it again then you can add up the following code for (b=1; b<=c; b++) { printf("\nThe numbers are\n"); printf("%d", a[c]); }
anonymous
  • anonymous
it will give you array out of bound error ? dont you noticed?
anonymous
  • anonymous
In C an array always starts at index 0, not 1. You can ask the user for the first number but the first position in the array is zero. And the highest index is the size of the array minus 1. 99 in this case. So you should use < instead of <= and starting at 0. Otherwise you could get an index out of range error when accessing index 100. #include #include main() { int a[100]; int b = 0; int c = 0; // c mustn't be higher than 100 // if c is greater 100, ask the user again do { printf("How many numbers do you want (max. 100)? "); scanf("%d", &c); } while(c > 100); // input for (b=0; b

Looking for something else?

Not the answer you are looking for? Search for more explanations.