i need to read from file two array with two different type (string and intger)
but when i wrote the c code to read the file :

char ON[row][30];
int RA[row][clo];
int i;
int j;
FILE*infile;
infile=fopen("rane.txt","r");
for(i=0; i<row; i++)
{  fscanf(infile,"%s",&ON[i]);
    for (i=1;i<row;i++)
        for(j=0; j<clo; j++)
            fscanf(infile,"%d",&RA[i][j]); }

then when i whant it to print it print something like that :

4740024
-61223616
504492512

how i could solve this problem?

Can you post your input file please? Also, what are the values of row and clo?

I assume that clo is supposed to be col. If so, I urge you to develop either better typing skills or better proofreading skills. It's simply not sufficient to just spew out a mess of code then ask "why doesn't this work"?

PS: ON and RA are meaningless variables. You should pick better names or comment your code to clarify.

commented: the input in file is: Jenin 500 550 450 Tul 400 580 455 Qal 300 550 450 Nab 600 550 460 //clo =3,row=4 +0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.