Main code skips function.

Hi im a beginner in programming and c++, and i'm trying to learn to use functions.
I don't get any errors but the main code just seems to skip the function i wrote.
I am using xcode as my compiler.
anybody know why?

code:
#include <iostream>

using namespace std;

void function()
{
cout << "rabarber!!! " << endl;
}

int main()
{
function;

cin.get();
return 0;
}

I haven't found any posts in the forum about this problem.
But if any of you know please link it to me.

Thx
First of all learn to put your code in code blocks , second you should call that function ( in main() ) like this :

1
2
3
4
5
6
7
8
9

int main()
{
function();  // see this 

cin.get();
return 0;
}


This should work fine
Last edited on
Topic archived. No new replies allowed.