Re: I have a problem in my study



On Mon, 30 Oct 2006 23:03:44 UTC, Mark McIntyre
<markmcintyre@xxxxxxxxxxx> wrote:

On 30 Oct 2006 01:54:09 -0800, in comp.lang.c , qazwsx746@xxxxxxxx
wrote:

I use operating systems of windows xp ,
and compiler is trubo c 3.0
when I input data,the following program can't be exited.
what happen to this program?
Is the wrong with the compiler?

#include <stdio.h>
main(int argc,char *argv[])
{ FILE *fp;
void filecopy(FILE *,FILE *);

its normal to declare function prototypes outside main. C doesn't have
the idea of local function definitions.

No. It is normal to declare a prototype where it gets used. That
includes it inside a function.

Yes, you would declare all prototypes outside any function - but when
you are sure that you needs it only inside one function it can be a
good idea to hide that from any else.

while ((c=getc(ifp))!=EOF)

how do you signal EOF? Remember, its not a character, its a signal.

Hey, the OP had declared c as int - and getc() does not return char
but int. Read your book what getc returns - an char wided to int or
EOF.

--
Tschau/Bye
Herbert

Visit http://www.ecomstation.de the home of german eComStation
eComStation 1.2 Deutsch ist da!
.



Relevant Pages

  • Re: int or long int?
    ... depending on "implicit int" is considered poor ... why your compiler warned you about it (unless you're using one of the ... declare the variable as int. ...
    (comp.programming)
  • Re: function call with arguments which takes no arguments
    ... >> Even compiler doesn't show any warning. ... > C allows function declarations with empty parentheses for backwards ... > correct if he/she chooses NOT to use prototypes. ... There is no "int ...
    (comp.arch.embedded)
  • Re: int or long int?
    ... depending on "implicit int" is considered poor ... why your compiler warned you about it (unless you're using one of the ... declare the variable as int. ...
    (comp.programming)
  • Re: Static vs. Dynamic typing (big advantage or not)---WAS: c.programming: OOP
    ... It could be - but just why you should want to declare something as, ... just declare everything as int or long. ... In both cases, you're saying something ... In my current compiler, int and long are the same size. ...
    (comp.object)
  • Re: Static vs. Dynamic typing (big advantage or not)---WAS: c.programming: OOP
    ... It could be - but just why you should want to declare something as, ... just declare everything as int or long. ... In both cases, you're saying something ... In my current compiler, int and long are the same size. ...
    (comp.programming)