We do use so many things to optimise our programs, from good algorithms to good data structures made specifically for that purpose. But, often we tend to write more lines of code which can be saved by using some special features offered in C++. These are known as preprocessor directives.
Till date, most of the people have been using just the #define directive to declare a variable. Most people dont know that they can even define functions in the preprocessor directives.
Throw in some comments, if you find this post good.
Till date, most of the people have been using just the #define directive to declare a variable. Most people dont know that they can even define functions in the preprocessor directives.
- #define REV(a,n) reverse(begin(a),begin(a)+n)
There are so many other templates that people use to make their
programming even faster
One more example of such an hack is the typedef keyword. This thing
particularly is more useful in competitive programming, where you can
save your time by making some typedef statements in the beginning of
program itself. Here's a sample code for the purpose:
While all these things are only a few techniques to reduce your time, here are some links where you can continue to read:
Also I have a github repository where I post some important links actively:
Throw in some comments, if you find this post good.
No comments:
Post a Comment