Spread the post

Find the name of given variable in c

There are possible to get variable name of c. use stringizing operator and micro defined function.

#define get_name(variable) #variable

Note that get_name are user defined you can change the name or parameter of this function

How to use this function.

1) Accepted any type of data and variable and constant strings and pointers.

2) Accepted value is a constant string. there are dont matter if you are passing varible name, constant string or pointer value. given value as accepted the form of only constant string.



Spread the post

Recommended Posts: