

The above code defines the function-like macro where the token is passed to concatenate two values of “p” and “q”.

here, instead of writing a*a we write (a)*(b) Here in the above macro is expanded as 2 +3 /3 + 5 = 2 + 1 + 5 =8 which is confusing so you can resolve by below modified macro. If the macro is used for a function-like macro which has arguments passed to it are not evaluated before macro expansion.The macro can also be written in multiple lines starting the statements with “\” and no need to end with “\”.Printf("\n This uses int datatype %d", INCREMENT(a)) Printf(" This use char datatype %s ", INCREMENT(p)) You should note that when the argument passed to the function-like macro where it supports any datatype.

For example, we saw in the above code “#include” in this “stdio.h” is a header file we use this header file because to read and print the values we use “printf” and “scanf” are within this “stdio.h” header file. Similarly “#include” is used to include the header files in the C program. In C language, when we use “define” for defining a macro with “#” prefixed is used for defining constants for the entire program, so when we define a constant with some macro name then in the entire program the defined constant is matched and is replaced with the value that is assigned at the starting of declaring the macro with “#define” statement.Before using macro in C programming we should note the following points:
