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.
在 C 的许多搜索函数中(想到 bsearch),如果找到结果,则返回指向数组中该点的指针。如何将此指针转换为搜索的数组中的索引(我假设使用指针算法)。
ptrdiff_t index = pointer_found - array_name;