Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Variable dynamic in c

Tags:

c

I have one requirement in C.

char abc[]="hello";
char hello[]="world";

Using abc whether we can get the hello variable's value in C. I know it is possible in some of the languages like Perl, Php, Bash,.,

Is it possible in C?

like image 477
sganesh Avatar asked Jun 07 '26 18:06

sganesh


2 Answers

Yes you are right , this is possible in some other language but not in C , since abc is a container which resides in a location (for ex: 1000) and hello is one more container which resides in another location ( for ex : 2000 ) , so we have no contact between these two arrays ,

we cannot make a value ( strings ) to point some other value. so finally THIS IS NOT AT ALL POSSIBLE.

like image 159
abubacker Avatar answered Jun 09 '26 08:06

abubacker


No, this is not possible in C without providing a string lookup table of some sort that could link variables with their names.

like image 40
Vicky Avatar answered Jun 09 '26 07:06

Vicky



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!