#define NAME "THING_ITS_REPLACED BY"#define will, when the code is compiled, replace any mention of name with anything proceeding it.
#define is low key crazy
#define TOES = 1024;
void main()
{
int test;
// This is actually real. This is a thing you can do. This is crazy
test TOES
printf("%d", test);
}- In this case, TOES is equal to “
= 1024;” literally. The linetest toesis actually justtest = 1024; - So not only can you declare some constant values. You can essentially store lines of code with
#definewith no regulations at all.
Unlike variables, define dies NOT take extra memory! That can be useful for cases where you have a constant like
\pithat you use everywhere
**