Re: Function prototypes
- From: pete <pfiland@xxxxxxxxxxxxxx>
- Date: Wed, 22 Aug 2007 22:00:52 -0400
Steph Barklay wrote:
Hi, I'm currently taking a data structures course in C, and my teacher
said that function prototypes are not allowed in any of our code. He
also said that no professional programmers use function prototypes.
That implies, or very nearly implies,
that professional programmers don't write C programs
with more than one file of source code.
It also suggests that your teacher has never
written a C program with more than one file of source code,
and thus is a neophyte programmer.
How old is this kid?
I hope that you're mistaken about what he said.
This
kind of bugged me, because from other people's code that I've seen in
the past, almost all of them use function prototypes.
The following also
bugged me. Let's say you have a file called main.c with only the main
function, and includes hello.h, to use functions within hello.c. So
hello.h should contain prototypes for the functions in hello.c,
so when
main.c is compiled, there won't be any warnings. If there aren't any
prototypes in the header file, my compiler would assume the function
called with main() is extern and returns an int.
I tried to explain this to my teacher,
but the answer he gave me is that I should just put the
whole function within the header file
and not have any other *.c files.
I haven't seen anyone put whole functions
within header files before. Am I wrong about this
No.
or is my teacher wrong?
He absolutely does not understand what header files are for,
and is giving very strong indications
that he has no experience with multifile C programs.
Thank you.
Again, I very much hope that you have misunderstood what he meant.
--
pete
.
- Follow-Ups:
- Re: Function prototypes
- From: Kenneth Brody
- Re: Function prototypes
- References:
- Function prototypes
- From: Steph Barklay
- Function prototypes
- Prev by Date: Re: Two questions about the following lines of code
- Next by Date: Re: macros
- Previous by thread: Re: Function prototypes
- Next by thread: Re: Function prototypes
- Index(es):
Relevant Pages
|