I'm relatively new to C, and part of a program I have to write requires finding the position of a 'space' character within the array, which I'm having a lot of trouble with. It's a 5x5 array with one space in it, a puzzle.
Here's what I have so far:
Code:
#include <stdio.h>
#define ROW 5
#define COLUMN 5
void fromAbove(char aboveArray[5][5]);
int main()
{
char array[ROW][COLUMN];
int row = 0;
int column;
FILE *infile, *outfile, *test;
infile = fopen("./puzzle.in","r");
outfile = fopen("./puzzle.out","w");
test = fopen("./test.out","w");
fprintf(outfile,"Puzzle #1: \n");
while(row <= 5)
{
for(column = 0; column < 5; column++)
{
fscanf(infile,"%c",&array[row][column]);
fprintf(outfile," %c",array[row][column]);
}
row++;
}
fromAbove(**array);
fclose(outfile);
fclose(infile);
fclose(test);
return 0;
}
void fromAbove(char aboveArray[5][5])
{
int row;
int column;
char a = aboveArray[row][column];
if(a == ' ')
{
printf("%c",aboveArray[row][column]);
}
}
Also, I'm getting these errors: "type of formal parameter 1 is incomplete", and "
passing argument 1 of āfromAboveā makes pointer from integer without a cast"
Any help would be appreciated. Thanks
P.S. sorry I'm new here so no idea how to post code properly yet...