Is this a global variable?

Would "int smallest();" be considered a global variable? If so, any hints as to how this program can still compute properly without it?

Thank you.

My code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>

using namespace std;

int smallest();

int main()
{

	int a, b;
	int x;
	x = smallest();

	cout << x << " is the smallest." << endl;

	return 0;
} 

int smallest() 
{
	cout << "Enter two numbers and I will tell you which is the smallest." << endl;
	int num1, num2;
	cin >> num1 >> num2;
	int smallest = num1 < num2 ? num1 : num2;

	return (num1, num2);
}
Nope, it's a function prototype.
Many thanks!
closed account (zb0S216C)
Global variables only apply to storage, for example:

1
2
3
4
5
6
7
8
9
10
11
int Global_A_;
extern int ::Global_B_; // Global storage elsewhere
static int Global_C_;

class Some_Class;
Some_Class Global_D_;

int main( )
  {
    // ...
  }

Wazzak
Last edited on
Topic archived. No new replies allowed.