How can I pass a char array as the parameter to a function? 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() &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;
}


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?
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!