Stringizing Operator in C | How to print a variable name in C?
Stringizing Operator: '#' in preprocessor directive is known as Stringizing Operator it is used to convert an argument into string format.
Print variable name using C program
Defining Macro:
#define macro_function(argument) #argument
Consider the example
Output:
Write a code for Debugging – print variable name with their values
Output:
printDebug
In this macro variable is passing in x, The statement printf("\nvalue of "%s" is: %d\n",#x,x); #x will convert the given argument in string and x will return the value.
need an explanation for this answer? contact us directly to get an explanation for this answer