Thread: Working with variable variables

  1. #1
    Registered User
    Join Date
    Jan 2008

    Working with variable variables

    First off, I apologize for my lack of skills (especially in the case where this solution is trivial). I need to work with a large number of enumerated variables, and know there has to be an easy way to do it without having to explicitly write it out.

    An example may be the following,

    double pl1,pl2,pl3,...,pl40;
    for(i=1;i<41;i++) {
       intermediate code that is different for each value of i and determines the values of 'd'
       pl#= d;  //where # is whatever the current value of i is
    Thanks! (Thanks even more if you can include a simple example of how I would do this!)

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    New Zealand
    Do you mean that you haven't learnt arrays yet? If not, what's stopping you?
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting number
    By Leslie in forum C Programming
    Replies: 8
    Last Post: 05-20-2009, 04:23 AM
  2. Reading Separate Digits as Variables
    By linuxpyro in forum C Programming
    Replies: 7
    Last Post: 09-13-2006, 05:23 PM
  3. Beginner question
    By Tride in forum C Programming
    Replies: 30
    Last Post: 05-24-2003, 08:36 AM
  4. Need help
    By awkeller in forum C Programming
    Replies: 2
    Last Post: 12-09-2001, 03:02 PM
  5. Variable Allocation in a simple operating system
    By awkeller in forum C Programming
    Replies: 1
    Last Post: 12-08-2001, 02:26 PM