 Hey everybody, it's Brian and this is our 25th video on C++. So it'll also be our last video on C++ unless you guys contact me wanting specific videos. I really want to move along to Qt programming and if you remember at the very beginning of all these tutorials I even said we're going to cover C++ what you need to know in order to do Qt programming. So moving right along today we're going to cover macros. Well if you go to www.cprogramming.com slash tutorials slash cpreprocessor.html you will actually find a very good article on the preprocessor including header files, constants, conditional compilation, comments, you know how to make sure a header file isn't included multiple times. We covered that in a previous tutorial. Today we're going to cover macros. Now what is a macro? A macro is a bit of code that is defined at the preprocessor level and you do that by saying pound define that's the preprocessor the macro name arguments and then the code to execute. So for instance you can do define increment x and then you're going to say x increment let's actually just copy that and we're going to write this code I want you to see what's going on and understand what happens here. So there is our bit of code our macro and we're going to say int b equals one and we're going to increment b and do cout b and l and let's run this and see what happens. Sure enough b has been incremented so that's a macro. Real quickly let's review. Here's our preprocessor directive we're going to define and the name of the macro is increment the argument list is x and it's going to just simply increment x and in this case x is b b is equal to one so b is going to equal two. Very simple now why do you need these we already have functions why do you need macros it's just another tool in your arsenal is really all it is. General rule of thumb is stay away from macros they are not very heavily used in the real world I don't recommend using them but you know here comes the catch 22 in acute programming which will be covering they do actually use a macro called q object and what that does is defines a class as a q object we'll cover that later I know it sounds a little bit confusing but for this tutorial all you need to know is what a macro is and why it exists well this is a short one I thank you for watching and I hope you found this video educational entertaining and like I said if you've got any requests for c++ videos please let me know