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.
when i try compiling this the 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(); }
In functionmain too few arguements to function void function[int]
at this point in file.
And this says: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); }
syntax error before ) token
Please tell me what is wrong and how to do it.
Thanks in advance



LinkBack URL
About LinkBacks


