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++ 上有一个简单的函数,它需要 2 个参数:
read(uint32_t *buffer, uint32_t num_words){ ... }
当我尝试调用它时,我得到一个错误,因为我传递的参数可能是错误的unsigned long*, unsigned long:
unsigned long*, unsigned long
uint32_t addr = 5; uint32_t buf[5]; read(buf,addr);
我不确定为什么这是错误的。有任何想法吗?
问题可能是因为编译器无法将指针转换为 const 指针(即数组变量)。将 read 的原型更改为 read(uint32_t buffer [], uint32_t num_words).. 这将起作用。