[Solved] Array of structs or pointer indexing ... Options / Best practice?

PaulS
I may well be wrong, given my current applicable skills, or lack thereof, the possibility is high.
However I fail to see how your comments are helpful, even if they are accurate which I may not be the case for all of them.
Do you take pleasure from making people, or perhaps just me, look silly?
I have said, and will say again .... I know that I know very little, I welcome criticism and expect to be proven wrong regularly but I would also expect that I would get corrected as opposed to simply being berated.
If you are going to point out an error could you perhaps give some indication as to what the solution might be?
Frankly if you cant be bothered to do that I would prefer that you didn't bother at all.

void MapFloatName(float * NewVarPtr, char NewName[]){      // function to build array data, fetching the pointer in the process

This function expects a pointer to a float as the first argument.

MapFloatName(& BatVolts,"BatVolts");

BatVolts IS NOT a float. &BatVolts is not a pointer to a float.
[/quote]
Line 1 of the program ...

float BatVolts = 13.5;

How BatVolts not a float?
So how is &BatVolts not a pointer to a float?

SERIOUSLY This is a question not a challenge to your premise.
If I am doing something fundamentally silly, please correct me.

ExposedVars[VarCount].Ptr = NewVarPtr;

Storing a pointer to itself in the struct is silly. If you have the struct instance, because it is the nth element in the array, then you don't need a pointer to the instance. In the GetVarRef() method, you could simply return the index to the instance in the array.

ExposedVars is an array of xVars, xVars being a type structure containing a single char[10], Name, and a float pointer, Ptr.
NewVarPtr is a float pointer, the first argument in MapFloatName(....
The pointer being passed in are:-

  MapFloatName(& BatVolts,"BatVolts");                              // A pointer to the float BatVolts
  MapFloatName(& ACVolts,"ACVolts");                                // A pointer to the float ACVolts
  MapFloatName(& BatVolts,"WindSpeed");                           // These lines is wrong when I copped and pasted I didn't edit properly.
  MapFloatName(& ACVolts,"PVCurrent");                             // &WindSpeed &PVCurrent is what should have been there but them that is self explanatory really

In all cases, even the erroneous ones, the pointer assigned to NewVarPtr is a global float.
How is that in any way ... Storing a pointer to itself in the struct.

Again please educate me if I am wrong.

The thing that you made Ptr point to is NOT a float

Well what is it then? ...
If it isn't a pointer then is isn't because of the previous error which you have already pointed out. Twice ... really?
Or perhaps I am being disingenuous and you have spotted another fundamental error, which you haven't told me how to fix!

As Nick points out, nothing in what you are doing requires pointers at all.

Yes he does ..
He then go's on to offer some really useful looking code examples, although he doesn't comment them so I know what thy do or how/why they work.
Clearly he is showing me a different, probably better, way to define an array. But then if I knew it all meant I would already be using it.

After that his code is puts 'name / value' pares into an array, again using code that isn't explained and clearly beyond my current understanding.
He then points out that because I have name value pares in an array I don't need a pointer.

Well ... I don't understand the construct that is used to define xVar[]
Since Nick is saying that I don't need pointers then I assume that the ' * ' and ' & ' are doing something else.
But that aside I assume my values are now in an array of xVars called Vals so to refer to them I need:-

vals [i].val = analogRead(analogPin)   // Or something simmiler

Not very readable is it, for a new guy I mean or perhaps someone coming back to code months after writing it.
O, and my original readable floats ... BatVolts and ACVolts, the ones that I had originally planned to use:-

BatVolts = analogRead(analogPin)     // Or something simmiler

When unless I run a loop to copy their values to the corresponding array values, which seems ludicrous from both a time and space perspective, I would have to ditch them.

The point of this was to make both the main code and my display definition files readable and descriptive.
I don't see how Nicks code achieves that whilst the pointers do.

Now Nick may well have come into this conversation late and made some assumptions based on skim reading the thread, we have all don it.
You on the other hand hand know exactly what I am trying to do and why.

It is perhaps not unreasonable to concede that you clever folk may not need descriptive readable code to prevent you from getting lost.
I however, do need it.
I will also freely admit that there may be a better way to do this but to date it hasn't been brought to my attention and I have been discussing elements of these topics for some time now.

Lastly If all the criticism you level at this code is correct then it wouldn't work right ...
Perhaps I haven't tested some scenario that will break it, I'v been there before and been educated.

Again please tell me why its wrong and at the very least where to look for a solution if you cant give me one for some reason.

More than a little frustrated
Al