C - Convert string to variable name

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

C - Convert string to variable name

Jump to solution
2,082 Views
andréluis
Contributor II

Hello, i'm using a MIMRXT100-EVK and i want know if it's possible to convert a string into a variable name using C. Or if i can compile some application in python or C++ to make this. 

Thanks for the help.

0 Kudos
Reply
1 Solution
2,063 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @andréluis,

This is not possible in programming languages like C or C++ Source 1, Source 2. As stated in the second link, C++ and specially C work by doing most of the computations during compile time rather than runtime. This way, the MCU executes a set of predefined (or precompiled) steps during runtime. Therefor, it cannot change it's variable names or recompile them in runtime, no. Source 1 has some code snippets that might prove to be work arounds, however.

Sorry for the inconvenience this may cause.

BR,
Edwin.

View solution in original post

0 Kudos
Reply
1 Reply
2,064 Views
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @andréluis,

This is not possible in programming languages like C or C++ Source 1, Source 2. As stated in the second link, C++ and specially C work by doing most of the computations during compile time rather than runtime. This way, the MCU executes a set of predefined (or precompiled) steps during runtime. Therefor, it cannot change it's variable names or recompile them in runtime, no. Source 1 has some code snippets that might prove to be work arounds, however.

Sorry for the inconvenience this may cause.

BR,
Edwin.

0 Kudos
Reply