Ok, I see.
In this case, itemlist would be dedicated to the malloc'd memory.
It would be a separate pointer that the requested list is assigned to:
Code:
char *configlist[NCONFIGS] = {"Ser", "Par", "Coil a", "Coil b"};
int coilcapvalue[NCOILCVALS] = {50, 60, 70, 80, 90, 100, 110, 120, 130, 140};
int getitemlist(int paramtype, char ***list)
{
switch(paramtype)
{ case PT_COILCAP:
for(int i = 0; i < NCOILCVALS; i++)
sprintf(itemlist[i], "%2d pF", coilcapvalue[i]);
*list = itemlist;
return NCOILCVALS;
case PT_CONFIG:
*list = configlist;
return NCONFIGS;
}
return 0;
}
Only two case examples shown - some cases will assign fixed string lists to the supplied pointer, and other cases will create the required strings in itemlist and assign itemlist to the pointer.
-