I am having trouble compiling this program, I have just about everything written up but the compiler errors are keeping me stuck at a standstill. In the WRITEARRAY and READARRAY function are where the main compile errors are giving me subscript is not of integral type and this is making no sense to me. Please help with any advice that you could give.
The second error I am seeing is that on line 39 at open=OPENFILEWRITES; i get a cannot convert from float (_cdecl) () to a 'float'
#include <stdio.h>
#define Max 4
#define MAX 6
void main(void)
{
FILE *openfilewrite ;
float open, write, read;
float i, a,b,c,j;
float arr[Max][MAX], arr1[Max][MAX];
float INITIALIZE(float ), MULTIPLY(float, int ), OPENFILEWRITES(), OPENFILEREAD(), WRITEARRAY(float), READARRAY();
printf("Please enter the integer");
scanf("%f", a);
arr[Max][MAX]=INITIALIZE(arr[Max][MAX]);
arr1[Max][MAX]=MULTIPLY(arr[Max][MAX],a);
open=OPENFILEWRITES;
write=WRITEARRAY(arr[Max][MAX]);
read=READARRAY(arr[Max][MAX]);
}
float INITIALIZE(float x)
{
float i=0, j=0;
for(i=0; i<4; i++)
{
for(j=0; j<6; j++)
{
x=(i+j);
}
}
return(x);
}
float MULTIPLY(float x,int a)
{
float i=0, j=0;
for(i=0; i<Max; i++)
{
for(j=0; j<MAX; j++)
{
x= a*(i+j);
}
}
return(x);
}
float OPENFILEWRITES()
{
FILE *openfilewrite ;
if((openfilewrite = fopen("outfile.nums", "w")) == NULL)
{ /*beginning of the if statement*/
printf("ERROR: file %s can not be opened!\n", "outfile.nums");
exit();
}
}
float WRITEARRAY(float x[Max][MAX])
{
FILE *openfilewrite ;
float i=0, j=0;
for(i=0; i<Max; i++)
{
for(j=0; j<MAX; j++)
{
fprintf(openfilewrite,"%f", x[i][j]);
}
}
}
float OPENFILEREAD()
{
FILE *openfilewrite ;
if((openfilewrite = fopen("outfile.nums", "r")) == NULL)
{ /*beginning of the if statement*/
printf("ERROR: file %s can not be opened!\n", "outfile.nums");
exit();
}
}
float READARRAY(float x[Max][MAX])
{
FILE *openfilewrite ;
float i=0, j=0;
for(i=0; i<Max; i++)
{
for(j=0; j<MAX; j++)
{
fscanf(openfilewrite,"%f", x[i][j]);
}
}
}