Teen Programmers Unite  


Return to forum top

C++ HW help please!

Posted by diegoeskryptic [send private reply] at March 28, 2002, 01:06:10 PM

For my assignment... my teacher told me to complete a program by adding function declarations, function implementations and variable definitions in the main program. I need to know exactly what are these three things... thanx

Posted by taubz [send private reply] at March 28, 2002, 01:48:54 PM

As the description of this forum says, no one on this site will do your work for you. You should have a textbook that describes these things. So without giving you answers, I'll describe each in a few words.

function declaration: something that tells the compiler of the existence of a function, the code of which may or may not be along side the declaration

function implementation: the actual code which makes up the function

variable definitions: something that tells the compiler that a certain "thing" is a variable, and that it should allocate memory for the variable

Good luck.

- taubz

Posted by diegoeskryptic [send private reply] at March 28, 2002, 01:55:51 PM

Oh... i wasnt expecting the answers.... i just wanted a visual example... for instance.... int him (int him1, int him2).... i needed sumthing like that... but thanx

Posted by CodeRed [send private reply] at March 28, 2002, 09:59:01 PM

A function declaration is also called a prototype. They goe below your includes and above the main function. They consist of the return type, the function name, and the parameter types and (optionally) names. A function implementation is simply writing the function. Variable definitions are simply declaring variables, you don't get much easier than that...

You must be logged in to post messages and see which you have already read.

Log on
Save for later automatic logon

Register as a new user
Copyright TPU 2002. See the Credits and About TPU for more information.