Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我怎样才能继续这个函数来搜索 int_set 数组中的“项目”并返回真/假?我不知道如何使用指针作为函数的参数
struct int_set { int * array; int max_elements; int current_elements; };
//功能
int int_set_search(struct int_set * ptr, int item){};
int int_set_search(struct int_set * ptr, int item) { for(int i=0; i < ptr->max_elements; ++i) { if (ptr->array[i] == item) { // Found it! return TRUE; } } return FALSE; }