Declaring variables in global scope.

Is it good practice? i.e

1
2
3
4
5
6
7
8
9
10
#include <iostream>

std::string hello;
int x;

int main()
{

}


Also, would declaring objects be bad?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <iostream>

class Hi
{
public:

};

Hi hi1;

int main()
{


}

Last edited on
I have never had to write a program that big, but imagine how much hassle global scope could become if you had multiple file program, it would be hard to debug
Topic archived. No new replies allowed.