i am trying to define "\n" in my cpp.json file which is the boilerplate for cpp and when i define it like "#define enl '\n'", and use it in my code, instead of getting #define enl '\n' i literally get a newline printed in my code. like:
#define enl '
'
is there any way to solve this?
full code:
{
"CPP": {
"prefix": "Bcc",
"body": [
"#include <iostream>",
"#define ll long long int",
"#define enl '\n'",
"using namespace std;",
"void solve(){}",
"int main(){",
" ios_base::sync_with_stdio(0);",
" cin.tie(nullptr);",
" int tc = 1;",
" cin >> tc;",
" for (int t = 1; t <= tc; t++) {",
" solve();",
" }",
" return 0;",
"}",
],
"description": "Log output to console"
}
}
i tried with both #define and typedef but it doesnot work. while if i write it manually like #define enl '\n' without using the boiler plate, it works fine like it should.
while trying to use "#define enl '\n'" in usersnippet we can use
\\
instead of \
to escape the \
that is causing to print a newline.
Thanks to @Holo for the Help :) .