I'm new to C so sorry in advance if this is so obvious.
Basically, I'm trying to take an input like below and put into a 2d array.
C 3.25 18. 0.01 .01 .02 .04 .08 .02 .02
A 0 7.5 .054 .031 .016 .008 .116 .124 .147
D -1.5 0.5 .012 .025 .05 .1 .1 .1 .025
I wrote a function in order to know the number of variables(so the number of rows) and I've taken the number of floating points.
count = numofvar(tokens);
scanf("%d %ld", &count_inter, &count_exper);
float data[count][count_inter + 3];
for(i=0; i<count; i++)
{
for(j=0; j<count_inter+3; j++)
{
scanf("%f", &data[i][j]);
}
}
printf("\n");
for(i=0; i<count; i++)
{
for(j=0; j<count_inter+3; j++)
{
printf("%f ", data[i][j]);
}
printf("\n");
}
Besides the floats, I'm also trying to store the letters in the beginning in to the array. (To understand what these values correspond to). However I get this weird output:
-3.817211 0.000000 0.000000 0.000000 -3.817268 0.000000 -3.817295
0.000000 0.000000 -3.817238 0.000000 -3.817232 0.000000 0.000000
-309364117239383605807310438400.000000 0.000000 20366038377015803904.000000 -65873193319006208.000000 0.000000 0.000000 -311890318855195825296505831424.000000
pc:~$ A 0 7.5 .054 .031 .016 .008 .116 .124 .147
A: command not found
pc:~$ D -1.5 0.5 .012 .025 .05 .1 .1 .1 .025
What should I do?