Hi, I have problem passing array from main to another function
Here is my code
#include <stdio.h>
#include <string.h>
# define Line_size 200
int processing(int lineCount, char harbour[Line_size][Line_size])
{
int i;
for(i=0;i<lineCount;i++)
{
printf("%s", harbour[i]);
}
}
int main ( void )
{
static const char filename[] = "data.txt";
static const char filename2[] = "data2.txt";
FILE *file = fopen ( filename, "r" );
FILE *file2 = fopen ( filename2, "r" );
int i, j;
char harbour[Line_size][Line_size];
char ship[Line_size][Line_size];
char line[Line_size];
char line1[Line_size];
int lineCount = 0;
/* Call Function Begin Here */
processing( lineCount, harbour);
for(i=0; i<sizeof lineCount; i++)
{
for(j=0; j<sizeof lineCount; j++)
{
harbour[i][j] = '\0';
}
}
for(i=0; i<sizeof lineCount; i++)
{
line[i] = '\0';
}
for(i=0; i<sizeof lineCount; i++)
{
for(j=0; j<sizeof lineCount; j++)
{
ship[i][j] = '\0';
}
}
for(i=0; i<sizeof lineCount; i++)
{
line1[i] = '\0';
}
if (( file != NULL ) && ( file2 != NULL))
{
i=0;
while (( fgets ( line, sizeof line, file ) != NULL ) && ( fgets ( line1, sizeof line1, file2 ) != NULL )) /* read a line */
{
strcpy(ship[i], line1);
strcpy(harbour[i], line);
i++;
lineCount++;
}
fclose ( file );
}
else
{
printf("File was not found\n");
}
return 0;
}
result display nothing