#include <stdio.h>
int main()
{
FILE *fp;
char ch;
fp=fopen("file1.txt","r");
while(feof(fp))
{
ch=fgetc(fp);
printf("%c",ch);
}
return 0;
}
How does fgetc()
know which character to print read (because fp
remains same throughout the program, not incremented); same for how does it identify EOF
? I mean, what does it actually refer to get to know where exactly it is now?
How can I retrieve that memory address and print it?