My output : 6 123456 44 0 67 87 0
What I want is this output: 10 123456 44 0 67 87 0 0 45 55 88
How come my program didn't print all the integer? Can anyone please help me to check what is wrong with my code? What changes should I make to my code? Here is my code.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
main()
{
char m[100][1000]={"123456","44","","67","87","","","45","55","88"};
int len;
int i;
int j;
int k;
int n;
int numm[1000];
n=0;
len=strlen(m[n++]);
printf("%d\n",len);
for (i=0;i<len;i++)
numm[i]=atoi(m[i]);
for (j=0;j<len;j++)
printf("%d\n",numm[j]);
for (k=1;k<len;k++)
{
if (numm[k]>100||numm[k]<0)
{
printf("Error. Marks out of range.\n");
exit(0);
}
}
return 0;
}
With a quick look i would say it's because you are using the same length (len) on both dimension
and your dimensions are differents