Last active
October 23, 2016 19:43
-
-
Save illescasDaniel/9b4d14b8df45156f99cc02ef58373b7b to your computer and use it in GitHub Desktop.
Variables reflection [C++]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
#define varName(_name_) #_name_ | |
#define varValue(_variable_) _variable_ | |
int main() { | |
int test = 10; | |
cout << varName(test) << ' ' << varValue(test) << endl; | |
// Output: test 10 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment