I was looking all over the internet and I still havent found a simple definition of these three terms and the difference between them...I was wondering If I could get some help differing them by showing a code example with them contained.
THANKS!
I was looking all over the internet and I still havent found a simple definition of these three terms and the difference between them...I was wondering If I could get some help differing them by showing a code example with them contained.
THANKS!
Well, surely you have some idea, even if it is not quite correct. So, what code examples would you venture to show us in answer to your question?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
I have no example code and its not for Homework or anything its to study for a test. I just need an example of a Function call, Function definition, and function prototype
As in you really don't have any idea? For example, consider this program:
Match "Function call", "Function definition", and "function prototype" with the portions labelled "A", "B" and "C". If you cannot do this, re-read your learning material again and just give it your best shot with an explanation of why you think what matches with what.Code:#include <stdio.h> /* A: */ void print_hello(void); int main(void) { /* B: */ print_hello(); return 0; } /* C: */ void print_hello(void) { printf("%s\n", "Hello world!"); }
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Function Prototype: A
Function Call: B
Function Definition: C
That wasn't so hard, was it?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
Lol the problem isnt the matching, the problem is if I'm asked what is the difference between these functions? Using computer terms of course would be nice and would make me feel more intelligent in computer programming...
Okay, at a syntactic level, think: why did you match what you matched? How do you know that they are what they are?
Next, what happens if you don't have the prototype in the program that I posted? What happens (or does not happen) if you don't have the function call? What happens if you don't have the function definition?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
To be honest, thats the order we learned that most general programs go in. I i had an idea i would say the function call in your code would be referring back to the function prototype. Without the function definition the program wouldnt know what to output I think.
Well, okay. I suggest that you take a look at Stroustrup's C++ glossary:
Declaration
Definition
function prototype
The explanations may contain C++ specific stuff, but generally it is the same.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)