双指针问题error passing through functions

double pointer problem error passing through functions

我有一个二维数组,我想通过函数传递

char blendModeOptions[18][16]={"Normal","Darken","Multiply","Color Burn","Linear Burn","Lighten","Screen","Color Dodge","Linear Dodge","Overlay","Soft Light","Hard Light",
    "Vivid Light","Linear Light","Pin Light","Difference","Exclusion","Hue"};

blendMode = KIT_CreateSelectOption(blendModeOptions,18,&blendModeRect);

函数的声明是:

KIT_SelectOption * KIT_CreateSelectOption(char ** options,int size ,SDL_Rect * rect);

我收到警告:

note: expected 'char **' but argument is of type 'char (*)[16]'

在函数内部我通过这个参数 KIT_AddOption(box,options[i]);

调用函数 int KIT_AddOption(KIT_SelectOption *box, const char * option);

当我在 KIT_AddOption

的这行代码中时,我的程序崩溃了
strcpy(opt->name,option);

我试过 char * option[16] 而不是 char ** option 但它不起作用。

您需要将数组定义为指针数组,而不是二维字符数组。

char *blendModeOptions[]={"Normal","Darken","Multiply","Color Burn","Linear Burn","Lighten","Screen","Color Dodge","Linear Dodge","Overlay","Soft Light","Hard Light",
"Vivid Light","Linear Light","Pin Light","Difference","Exclusion","Hue"};