Will the following code compile?
int a = 0;
double b = 0.0;

namespace space1
	int a=1;
	double b=1.0;
namespace space2
	int a=2;
	double b=2.0;
int main()
	int a=0;
	double b=0.0;

	return 0;
Yes, it will. Variables from different namespaces can have the same names.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Sign Up Now
or Subscribe for future quizzes