my output should be like this
Code:
array1:firstnames array3:lastnames array3:phonenumbers
Code:
#include <stdio.h>
#include <string.h>
int main()
{
char c[50]; /* declare a char array */
FILE *file; /* declare a FILE pointer */
file = fopen("in.txt", "r");
if(file==NULL)
{
printf("Error: can't open file.\n");
return 1;
}
else {
printf("File opened successfully. Contents:\n\n");
while(fgets(c, 50, file)!=NULL)
{
printf("String: %s", c);
}
printf("\n\nNow closing file...\n");
fclose(file);
return 0;
}
