#define BLAH word
cout << BLAH;
Is there any way to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
‘cout’ is not something you do. It is a global variable, which is an instance of the
std::ostreamtype. You could say e.g. “output tocout“.#definedoes textual substitution. It is basically the same as if you used search-and-replace in your text editor to replaceBLAHwithword. Thus, the linecout << BLAH;turns intocout << word;. If it’s not working, it’s becausecout << word;isn’t a valid statement in that scope. The preprocessor does not care about any of the surrounding text. It has basically zero understanding of the code (it knows how to tokenize the code, i.e. break apart operators and other punctuation if you don’t put in any space, but that’s about it.)