Your program actually works. For sure it is not robust and you are probably feeding it with a bad data file.
A slightly modified it (removed the useless
cout
call, as well the legacy
conio
header, etc...)
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE *in;
in = fopen("A.txt","r");
double f;
int i,j;
const int n = 430;
double **arr;
arr = (double**)malloc(sizeof(double*)*430);
for(i=0;i< 430; i++)
arr[i] = (double*)malloc(sizeof(double)*430);
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
fscanf(in, "%lf",&f);
fprintf(stdout, "%.15lf",f);
arr[i][j] = f;
printf("A[%d][%d] = : %f",i,j,f);
}
}
printf(" MAtrix A Fed \n");
getchar();
fclose(in);
}
then I fed it with the random numbers generated by the following program
#include <stdio.h>
#include <stdlib.h>
const int N = 430;
int main()
{
int i,j;
for (i=0; i<N; ++i)
for(j=0; j<N; ++j)
{
if (j %10)
printf(" ");
else
printf("\n ");
float f = ((float)rand()/RAND_MAX);
printf("%12g ", f);
}
return 0;
}
and eventually got the
Matrix A Fed
message.