DeclareOriginally Posted by Dave_Sinkula
DeclareOriginally Posted by Dave_Sinkula
Okay, there you go.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
it is not the standard. define or declare it does not matter.Originally Posted by noodles
C&V, pleaseOriginally Posted by Three
What is C&V ?
Chapter and Verse, please
This is obviously pointless.
Christ on a cross. There is nothing in the Standard that prohibits you from putting a function prototype in a function. It's just an incredibly stupid idea. To give a rather discrete example:
You'll get a compiler error for conflicting types of foos. With this foo() can't be used outside of main().Code:void bar() { /* I guess bar does other stuff too. */ foo(); } void foo(void) { } int main(void) { void foo(void); foo(); bar(); return 0; }
Last edited by whiteflags; 10-27-2006 at 01:21 AM.
Your example is flawed. The reason you can't use foo in bar is because you're trying to call it before it's been seen anywhere. You can never do that. That has nothing really to do with prototyping inside of a function or not.
Quzah.
Hope is the first step on the road to disappointment.
I suggest you look up the page nos I mentioned from K&R2, they've provided some good examples of it's usage (i.e making functions available only to functions that need them, like the idea of using local variables instead of global ones).Originally Posted by citizen