我有一个指针字符数组
void main(){
char* array[] =
{
[0] = "foo",
[1] = "bar",
[2] = "baz"
};
read(array);
}
并尝试使用获取长度时strlen
int read(const char* events[]){
int size_of_events;
size_of_events = (strlen(events));
}
它会引发以下警告:
warning: passing argument 1 of ‘strlen’ from incompatible pointer type [enabled by default]
In file included from test.c:6:0:
/usr/include/string.h:395:15: note: expected ‘const char *’ but argument is of type ‘char **’
看不懂是什么问题。。