I need to modify the stuff I have in stringList to be hex, and I need to do it inside MyFunction because WriteI2C needs to take in a hex value. For example, if stringList contained ‘5’ and ‘A’, I would want to pass 0x5A into WriteI2C.
char* stringList[5]; // array of strings (max 5 strings)
char* (*stringListPtr); // pointer to a string
void MyFunction(char* (char* (*stringListPtr))
{
WriteI2C(a hex value); // ex: WriteI2C(0x5A);
}
Can you use NUL-terminated arrays of
char(a. k. a. C strings)? If so:If not, you may want to make a NUL-terminated copy, or to reinvent the wheel (note: don’t reinvent the wheel):