in my project I used arrays not pointers. My purpose is here copy all characters one-by-one from text.file into array. I found some examples from the Internet, this site but none of them was useful for me. Think that input1.txt is "abcd" I want like these input1[0] = a, input1[1] = b, etc.
main ()
{
FILE *f1 = fopen("input1.txt", "r");
int i;
fseek(f1, 0, SEEK_END);
int inputsize = ftell(f1); //its about text's size
char input1[inputsize];
for(i = 0; i < inputsize; i++)
{
fscanf(f1, "%c", &input1[i]);
}
printf("%c ", input1[3]);
getchar();
}
When I run this code it doesn't print "d", but prints "6". Why is this happening? What should I do? Thanks for help