fgetc, checking EOF

You can’t cast the return value to char because the return value could be EOF, and EOF value is system-dependent and is unequal to any valid character code. link Usually it is -1 but you should not assume that. Check this great answer from the c-faq-site: Two failure modes are possible if, as in the … Read more

How to read these mixture of data in C

This program reads from the file and converts the tokens to floats. You should read an entire line and tokenize it. Then you just need to create an array and add to the array at the right place in the code. #include <stdio.h> #include <stdlib.h> #include <memory.h> int main(void) { FILE *sp1; char line[256]; double … Read more