if you are new to c++, have you had programming experience before, I'm inclined to believe no because you are wondering how to call a fxn. if you are new to programming in general, you would want to learn concepts and other things before thinking about win32api and games.

but for a fxn, ex. a fxn to cout something would be like the following:

for very very short functions use "inline" it makes it go faster...but you cant tell the difference because instead of calling the function it places the body of the function in where it is being called....hehe

02-19-2003

myUserName

Well ive programmed in javascript before, but im not an expert.. ive tried writing

<code>

#include <iostream>

int main()
{

function();

}

int function()
{

}
</code> but it doesnt work... maybe i just forgot that semicolon

02-19-2003

minesweeper

Problem here is that the compiler has never heard of your function before you call it in main.

Put

int function();

above main and see if that works.

02-19-2003

myUserName

Okay ive tried the following code:

Code:

<code>

#include <iostream>

int main()
{

function();

return 0;
}

int function()
{

std::cout << "A function" << std::endl;

return 0;
}

</code>

im using dev-c++4 and it says "implicit declaration of function 'int function(...)'"

02-19-2003

minesweeper

Code:

#include <iostream>

int function ();

int main()
{

function();

return 0;
}

int function()
{

std::cout << "A function" << std::endl;

return 0;
}

Try that

02-19-2003

abrege

power to non-prototyped functions!

Code:

#include <iostream>

int function()
{

std::cout << "A function" << std::endl;

return 0;
}

int main()
{

function();

return 0;
}

02-19-2003

alpha

you either have to prototype the fxn or place the whole fxn above main. fxns can only see what is above them.

02-19-2003

xzozx

1 Attachment(s)

I am ok at C++... I made a VERY simple program to let you see how some basic things work, if you already don't know how. I havent error checked it yet, and I know that the char does not work but you get the idea. :o