Can you refer to an array (or another variable) by name in a variable itself?

Subject line says it all. I want a function to read a number of arrays, any one of which would be specified by an argument. I could use a switch... case, but that seems like over-engineering something simple.

No, once code gets compiled all the names are gone. You need pointers or multi-dimensional arrays.

As D_G suggests, look into an array of pointers where each entry would be your array name which, by definition, are the pointers to index 0 of the array.

Pointers may be beyond me for the time being. I may use multidimensional array, it would solve half of my problem. The full problem is this:

When did sensor "rd8" last change value, and what was that value? Yes, I could specify vars for every frickin' sensor, but that is horribly inefficient. Therefore the names, last changed millis() value, and value are stored in arrays. I just want a function to find that name, then move horizontally to a chosen column and return the datum. Like hlookup("tc7","wasValue");.

name lastMS wasValue
=== === ===
mc7 1000 0
pir7 1500 1
pir8 2200 0
rd7 0 1
rd8 99 1
tc7 999 454

mattlogue:
Pointers may be beyond me for the time being. I may use multidimensional array, it would solve half of my problem. The full problem is this:

When did sensor "rd8" last change value, and what was that value? Yes, I could specify vars for every frickin' sensor, but that is horribly inefficient. Therefore the names, last changed millis() value, and value are stored in arrays. I just want a function to find that name, then move horizontally to a chosen column and return the datum. Like hlookup("tc7","wasValue");.

name lastMS wasValue
=== === ===
mc7 1000 0
pir7 1500 1
pir8 2200 0
rd7 0 1
rd8 99 1
tc7 999 454

Try an array of structs.

EDIT:
Reference: Data structures - C++ Tutorials

The "names" only differ by a number. All you need is an array. Or an array of structs to bind all the data for each one together.

You're going to have to learn about pointers one day. Maybe not today, but...

An array is fine to store the data, which exists in two dimensions, the latter being hard coded. I could just loop through it and find a match.... I'm not sure yet.

Pointers to arrays don't really open up, for what I can see, an avenue to find a row. I have to specify column and row numerically still.

I can't see the question for the hand-waving.

Please post the code of your best attempt, and explain clearly what you expect that code to do.

Pieter

Based on the minimal information that you provided, you’ve been given the answer – TWICE. Use an array of structs.

mattlogue:
When did sensor "rd8" last change value, and what was that value? Yes, I could specify vars for every frickin' sensor, but that is horribly inefficient. Therefore the names, last changed millis() value, and value are stored in arrays. I just want a function to find that name, then move horizontally to a chosen column and return the datum. Like hlookup("tc7","wasValue");.

struct Sensor {
  byte pin;
  char *name; // if you must
  int value;
  uint32_t timeLastRead;
};

Sensor some_sensors[] = {
  { A0, "rd5", 0,0},
  { A1, "xyz", 0,0},
  { A2, "The Thingy", 0,0}
};

I’d make both the pointer and what it’s pointing to const. Changing either would be bad.

struct Sensor {
  byte pin;
  const char * const name; // if you must
  int value;
  uint32_t timeLastRead;
};

Sensor some_sensors[] = {
  { A0, "rd5", 0,0},
  { A1, "xyz", 0,0},
  { A2, "The Thingy", 0,0}
};

Thank you! Ill base it off the example you provided.