Tag: incompatibletypeerror

使用指针时不兼容的类型

#include #include typedef struct contact { my_string name; my_string email; int age; } contact; typedef struct contact_array { int size; contact *data; } contact_array; void print_contact(contact *to_print) { printf(“%s (%s) age %i\n”, to_print->name.str, to_print->email.str, to_print->age); } int main() { int i; contact_array contacts = { 0, NULL }; for(i = 0; i < contacts.size; i++) […]

C警告:不兼容的指针类型传递

我在尝试编译代码时遇到错误。 错误如下: warning: incompatible pointer types passing ‘void *(threadData *)’ to parameter of type ‘void * (*)(void *)’ [-Wincompatible-pointer-types] pthread_create(&threads[id], NULL, start,&data[id]); 我正在尝试将一个结构传递给函数, void * start(threadData* data) ,这一直让我失望。 有任何想法吗?