S
santosh
Amali said:I got what they pointed out.but in this project they are mostly
considering about only the documentation. And it is no enought to this
project what we learnt in the class. Now i need to learn more about c
programming.
What you want to do can be done with just the basics of C and a few
Standard library functions. The problem is that you're unwilling to
correct the errors and other ill-advised constructs in your code that
posters in this thread have repeatedly pointed out to you.
Your program, as it stands, is simply incorrect. If it appears to
work, be assured that it's only so by pure chance. At a minimum
correct the following:
1. Change the line 'void main(void)' to 'int main(void)' and place a
'return 0;' statement at the very end of the main function.
2. Remove all instances of 'fflush(stdin)'. It's undefined.
3. Replace all uses of gets(s) with fgets(s, SIZE_OF_S, stdin).
4. Check for end-of-file with the return value of the function you use
to read. It'll return EOF if end-of-file occurs.
5. Correct your use of fscanf. It keeps overwriting previous values.
Use an array instead of a single variable for holding the input.
If you don't know how to use any of the features I've listed above, or
how to correct your program, please ask, but simply posting the same
incorrect code again and again is not helping anyone.