user17150: I am creating a menu for adjusting system variables.
The menu is made up of pointers like so:
char* options4[] = {"hMin1", "hMax1", "refr1", "fSpeed1"};

I want to pass the selected string as the parameter for an 'adjust' function for use in some conditional logic and for display on a HCMAX7219 7 segment display. Here's what I've got:
int option = 0;
float variable = 82.0;

if(Serial.available() > 0) {
  key = Serial.read();
  if(key == back) {
    return;
  } else if(key == fwd) {
    float newVar = adjust(String(options4[option%4]), variable);
  } else if(key == down) {
    option++;
  } else if(key == up) {
    option--;
  }
}

float adjust(char* str, float var) {
  ...do some stuff...
  display.print7Seg(str, 8);
  EDIT: forgot this call..
  display.print7Seg(var, 1, 4);
  ...do stuff to var...
  return var;
}

The library function takes (char[] TextString, unsigned int Offset) as it's parameters.
EDIT: the library also has functions print7Seg(long number, byte decimalPlace, unsigned int Offset) and print7Seg(long number, unsigned int Offset)
Now I'm new to pointers, but I can see that I am passing a pointer to my adjust function, and expecting it to dig out a char array from memory. I can't see any problems with that, though I may be missing something. When I try to compile, the IDE just crashes with exit status 84; so no debug info.
Am I going about this the wrong way?

user13432: There are one or two things missing in your code. Where is setup() and loop()? Or is it just a snippet?
But answer to the question first. This is not right:
newVar = adjust(String(options4[option%4]), variable);

Should be:
newVar = adjust(options4[option%4], variable);

You want to index the vector of strings and pass one of the elements to the function.
Cheers!

17150: <p>I am creating a menu for adjusting system variables.</p>

<p>The menu is made up of pointers like so:</p>

<pre><code>char* options4[] = {"hMin1", "hMax1", "refr1", "fSpeed1"};
</code></pre>

<p>I want to pass the selected string as the parameter for an 'adjust' function for use in some conditional logic and for display on a HCMAX7219 7 segment display. Here's what I've got:</p>

<pre><code>int option = 0;
float variable = 82.0;

if(Serial.available() &gt; 0) {
  key = Serial.read();
  if(key == back) {
    return;
  } else if(key == fwd) {
    float newVar = adjust(String(options4[option%4]), variable);
  } else if(key == down) {
    option++;
  } else if(key == up) {
    option--;
  }
}

float adjust(char* str, float var) {
  ...do some stuff...
  display.print7Seg(str, 8);
  EDIT: forgot this call..
  display.print7Seg(var, 1, 4);
  ...do stuff to var...
  return var;
}
</code></pre>

<p>The library function takes <code>(char[] TextString, unsigned int Offset)</code> as it's parameters.</p>

<p>EDIT: the library also has functions <code>print7Seg(long number, byte decimalPlace, unsigned int Offset)</code> and <code>print7Seg(long number, unsigned int Offset)</code></p>

<p>Now I'm new to pointers, but I can see that I am passing a pointer to my adjust function, and expecting it to dig out a char array from memory. I can't see any problems with that, though I may be missing something. When I try to compile, the IDE just crashes with exit status 84; so no debug info.</p>

<p>Am I going about this the wrong way?</p>
 13432: <p>There are one or two things missing in your code. Where is setup() and loop()? Or is it just a snippet?</p>

<p>But answer to the question first. This is not right:</p>

<pre><code>newVar = adjust(String(options4[option%4]), variable);
</code></pre>

<p>Should be:</p>

<pre><code>newVar = adjust(options4[option%4], variable);
</code></pre>

<p>You want to index the vector of strings and pass one of the elements to the function.</p>

<p>Cheers!</p>
