Is it considered proper to have code like this:
#include <FILEHERE>
using namespace std;
char input;
int main() {
cin >> input;
cout << input;
return 0;
}
I know that this code will work, but is is considered proper and is there a better wat to do it?
The reason I am using code similar to this, (but far more complex), is because I have a thread and the main function both using this string at some point, and the only way I could think to declare it for both the thread and main function was to declare it outside the thread and main function. What is a better way to do this?
EDIT: I am not asking about using namespace std; as I use it in almost every program I write.
You can pass a pointer to a variable local to main thread: