C - Convert string to variable name

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

C - Convert string to variable name

ソリューションへジャンプ
2,158件の閲覧回数
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 件の賞賛
返信
1 解決策
2,139件の閲覧回数
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 件の賞賛
返信
1 返信
2,140件の閲覧回数
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 件の賞賛
返信