I'm using the Dev C++ 5 compiler and for all the time I've been programming I've been using global variables. I've always read that it's dangerous and now I've come across a time when errors have occured. The problem is that I can seem to be able to use a variable from int main() without causing errors.

Code:
#include <iostream>
using namespace std;
void function(int x);

void function(int x)
{
     x = 5;
     cout<<x;
     cin.get();
}

int main()
{
    int x;
    function();
}
when i try compiling this the errors:
In functionmain too few arguements to function void function[int]
at this point in file.

Code:
#include <iostream>
using namespace std;
void function(int x);

void function(int x)
{
     x = 5;
     cout<<x;
     cin.get();
}

int main()
{
    int x;
    function(int x);
}
And this says:
syntax error before ) token

Please tell me what is wrong and how to do it.
Thanks in advance