Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

A newbie question about C

Name: Anonymous 2011-08-07 10:10

If you compile a function in a seperate source file and then use it in another file, do you need a prototype for that function in any file wherein it is called or just in the original one?

Thank you.

Name: Anonymous 2011-08-07 10:16

shut the fuck up you fucking piece of shit n00b. go read the fucking manual before you post your gargle here.

Name: Anonymous 2011-08-07 10:40

I'm up to page 70 in K&R and it is still not explicitly stated The book speaks of function definitions, but as a prototype can be omitted one could argue it is a declaration rather than a definition. I am just asking whether a prototype in the file in which the function appeared in is 'inherited' by other files that invoke the function from that file.

Name: Anonymous 2011-08-07 10:43

do you include <stdio.h>?
yes.
do you use prototypes when you are using printf()?
no.

Name: Anonymous 2011-08-07 10:46

>>4 Yipee for missing the obvious. Now I feel (rightly) stupid. Thanks anyway.

Name: Anonymous 2011-08-07 11:07

conio.h makes your app 20 orders of magnitude faster

Name: Anonymous 2011-08-07 11:49

>>6
For me it's only about 14-17 magnitudes faster...?

Name: Anonymous 2011-08-07 11:52

>>7
Try including stdafx.h before conio.h.

Name: Anonymous 2011-08-07 13:21

you use a prototype, or include a header with prototypes in it.

Name: Anonymous 2011-08-07 13:26

C is a shitty language, just don't use it.

Name: Anonymous 2011-08-07 13:43

>>6
In that case using Windows.h is 40 times faster.

Name: Anonymous 2011-08-07 18:41

>>8
Try including stdafx.h before conio.h.

Those aren't standard C header files. Now go back to serving another customer you nowhere bitch.

Name: Anonymous 2011-08-07 18:52

>>8
And more to the point you uneducated faggot, if you are gonna give out uniformed advice, at least tell the OP to use include guards *before* and *after* the non standard header files. Btw, this is how a lot of real world C code gets written and compiled. But you would have only known this if you worked a real programming job.

Name: Anonymous 2011-08-07 18:52

>>8
AWESOME! THANK YOU! It worked!

Don't change these.
Name: Email:
Entire Thread Thread List