Originally Posted by
JonathanS
The book I'm using said that once it hits a fn (function) that it doesn't know, it skips down until it find the declared fn, and executes it. Wonder why it doesn't :/
Because the book you're using is WRONG.... C compilers read a page top down. If they find a reference to something that is neither defined nor prototyped they make wild assuptions about it and then when the assumptions are proven wrong, they error out.
You have the following two options...
Code:
#include <stdio.h>
void jerk (void);
int main( void )
{
printf("He calls me on the phone with nothing to say\n");
printf("Not once, or twice, but three times a day!\n");
jerk();
printf("He insulted my wife, my cat, my mother\n");
printf("He irritates and grates, like no other!\n");
jerk();
printf("He chuckles is off, his big belly a-heavin'\n");
printf("But he won't be laughing when I get even!\n");
jerk();
return(0);
}
void jerk( void )
{
printf("Bill is a jerk\n");
}
or
Code:
#include <stdio.h>
void jerk( void )
{
printf("Bill is a jerk\n");
}
int main( void )
{
printf("He calls me on the phone with nothing to say\n");
printf("Not once, or twice, but three times a day!\n");
jerk();
printf("He insulted my wife, my cat, my mother\n");
printf("He irritates and grates, like no other!\n");
jerk();
printf("He chuckles is off, his big belly a-heavin'\n");
printf("But he won't be laughing when I get even!\n");
jerk();
return(0);
}
It's got nothing to do with C or C++ compilation... they both have the same rules, in this case.
And by the way... not wanting to scroll down is a pea arsed poor reason to use bad programming practices.