noob calling value in func help
Hi, I am a complete noob at programming and thought I would combine 2 lessons that I have learnt.
1. assigning a number/value to a letter.
2. function returning a value.
I am trying to call the function testing which holds 'y' declared as the number '2', but all that comes up on the 2nd line is the number '35'.
I am using bloodshed dev-c++.
Thanks for any info you can give me.... usually I find the problem after a while.
Code:
#include <iostream.h>
using namespace std;
void testing();
int main()
{
int x;
x = 1023;
cout << "this program prints the value of x: ";
cout << x;
cout << "\n";
testing();
cout << "This line will print the value of y:";
cout << y;
cout << "\n";
system("PAUSE");
return 0;
}
int testing()
{
int y;
y = 2;
}
Edit: I would really like to call the value from the other func... not the main() if possible.