Everyone does.
A
function prototype tells the computer what a function looks like: the number and kinds of arguments it takes, and what kind of thing it returns. An example:
int wmove(WINDOW *win, int y, int x);
This tells you that the function
wmove() takes three arguments (a pointer to a WINDOW and two integers) and it returns an integer.
To
call the function (or
use it), you simply give it values for the arguments (either literals or a valid value identifier), and if the function returns a value you may assign it to a variable.
When you prototype a function, it tells the compiler that the function exists, even though the compiler knows nothing else about it at the moment. Hence, you'll see code like:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
#include <iostream>
using namespace std;
int main( int argc, char* argv )
{
void greet( const char* name ); // this is a prototype -- this function must exist somewhere
if (argc == 2)
greet( argv[ 1 ] ); // here we use the function
else
greet( "world" ); // and here also
return 0;
}
void greet( const char* name ) // this is the function definition
{
cout << "Hello " << name << "!\n";
}
|
The
NCurses functions are already defined in the library (which you use when you compile with the
-lcurses option). They are also already prototyped (you get the prototypes when you #include <ncurses.h>). Hence, all you need to do is call, or use, the functions.
Here are some example programs, both of which make use of the
wmove() function to position the cursor:
http://www.cplusplus.com/forum/beginner/4520/#msg19965
http://www.cplusplus.com/forum/general/497/#msg1734
Hope this helps.