I´ve rewritten my array program:
Code:
#include <stdio.h>
int main()
{
int a;
int b;
int c;
int array[10];
printf("Enter an amount of slots to produce: ");
scanf("%d", &c); //Will request c, to which the other integers will be compared to see if the loop has to run another time.
for (a = 0; a != c; a++) //This for loop generates numbers to put in the array.
{
array[a] = a;
}
for (b = 0; b != c; b++)//This for loop will print out every nummer which is present in the array.
{
printf("%d\n",array[b]);
}
getchar();
getchar();
return 0;
}
If you input more than 13 for c, it will crash. Does anyone know what the cause of this is, and how I can fix it. I'm using the Bloodshed Dev C++ compiler.
Thank You,
OmnificienT