Well I was suprised to see something like this :
(Error “Expected an expression”).
I had included the map header file as well as defined TMap
in “.cpp” file.
If i use std::map
in IsIsogram()
instead of defining #define TMap = std::map
for it IT WORKS! without any error
Anyone give me a clue/suggestion for resolving this error
#define
is a textual replacement, it has no knowledge of C++ syntax or anything else for that matter.
It’s super dumb and will blindly replace the token with the replacement text. i.e. for what you have written it will replace TMap
with = std::map
So when you write
TMap<char, bool> letterSeen;
It’s going to replace that so you have
= std::map<char, bool> letterSeen;
@DanM Thanks a lot I’ve got my misconceptions cleared between using abc = data_type
and #define
, Thanks
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.