
June 22nd, 2009, 05:51 PM
|
|
Registered User
|
|
Join Date: Feb 2009
Posts: 4
Time spent in forums: 1 h 13 m 30 sec
Reputation Power: 0
|
|
|
Passing Variables Between functions.
EDIT: It seems sleeping on it has fixed the problem. I kept defining a new function to fix an error when all I needed to do was add ";" to end the line. Knew it must have been something stupid.
Hi, Its been a bit since I did some c++ coding am im still very new to programming all together. Anyway my problem is with this code.
Code:
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int FuncOne(int b)
{
cout << b;
}
int main()
{
int a = 4;
int FuncOne(a);
system("PAUSE");
}
The problem is I want to transfer integer a which equals 4 over to FunctionOne where it is asigned as integer b and printed on screen. The only problem is it wont do this and I seem to have tried all I can think of. I have narrowed it down to that FuncOne doesnt seem to run when it has int before it but when im transferring variables the debugger insists I have int before the function when I call it.Im sure this has a simple answer and I apreciate the help.
|