【发布时间】:2013-03-28 11:09:11
【问题描述】:
我正在尝试将整数数组传递给 Cython 中的函数,但我不明白为什么会出现标题中提到的错误。
我正在尝试做的示例代码如下:
cpdef foo(int *table):
for i in range(10):
table[i] = i
cdef int *temp=<int *>malloc(10*sizeof(int))
foo(temp)
for i in range(10):
print temp[i]
我将不胜感激有关如何将数组正确传递给函数的任何指针。谢谢。
【问题讨论】:
标签: python pass-by-reference cython