CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

using a variable to call a variable without if statements?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
zlittell



Joined: 08 Feb 2012
Posts: 13

View user's profile Send private message Visit poster's website

PostPosted: Thu Mar 08, 2012 1:46 am     Reply with quote

thats what I figured... there was probably a way to do what I wanted but not as efficiently as the idea sounds itself. I will just be sticking with the array I have working now.

I can't wait to finish this project. I want to spend some extra time making some neat little examples and libraries that I can put out there for everyone to use.

gpsmikey I will be giving that article a read when I get a chance to sit down with some free time.

I am also excited to play with my MikroE Stellaris ARM board thats coming in the mail! its nerd christmas haha

-zack-
Ttelmah



Joined: 11 Mar 2010
Posts: 19803

View user's profile Send private message

PostPosted: Thu Mar 08, 2012 5:36 am     Reply with quote

dorinm wrote:
you need an evaluator ...
tx_msg[2]=("P" + profile + "M1") ..mainly, to concatenate " "P" + profile + "M1" " into a string (a lot of mcu cycles!) , then evaluate the expression and compare to your defines ... basically it can be done, but would you waste so many mcu cycles?


No....

Think about it. tx_msg[2], can take a _character_, not a string.
He seemed to want to build a 'variable name' from a string plus the contents of a variable, and then access the character in the variable with this name.
Not possible, unless you build your own table of names, and search in this with string compare functions.
Variable names, don't even exist in the running code.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group