Multidimensional array acting strangely
#include <stdio.h>
#include <stdlib.h>
char number[5000]="37107287533902102798797998220837590246510135740250\
46376937677490009712648124896970078050417018260538\
.....more numbers.....";
char numbers[100][50];
main()
{
int x,z;
extern char numbers[100][50],number[5000];
for(x=0;x<100;x++)
{
for(z=0;z<50;z++)
{
numbers[x][z]=number[50*x+z];
}
}
printf("%s\n",numbers[0]);
}
So the thing is I have this code and for some reason numbers[0] is being
the same as number. Isn't numbers[0] supposed to be the first 50
characters first.I can't figure this out.Thanks in advance.
No comments:
Post a Comment