in this below code macro 1 is always fine
but, macro 2 is not working if statement 1 is not written..why is this happening?
//using namespace std; //--statement 1
#define l std::cout<< //--macro 1
#define nl std::cout<<endl; //--macro 2
nl // this is not working if i dont use statement 1
l "a new line";
This is not the question of your MACRO.
The endl object also belongs to the std namespace, therefore either you should use
std::cout << std::endl;
using namespace std; cout << endl;