error info:
.tools.c(17775): error C2069: Cast from “void” to non-void
.tools.c(17775): error C2036: “void *” : unknown size
my code:
This function attempts to free the memory of one-dimensional array or two-dimensional array, but do not work.
cdef void free_memory(void* arr, int ndim, int rows):
cdef int i
if ndim == 1:
free(<double*>arr)
elif ndim == 2:
for i in range(rows):
free(<double*>arr[i])
free(<double**>arr)
else:
raise ValueError("Unsupported number of dimensions (ndim must be 1 or 2).")
example:
cdef double** array = <double**> malloc(n * sizeof(double*))
free_memory(array , 2, n)
I have tried to modify it many times, including using gpt assistance, but it still doesn’t work.
user27199655 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Digital Marketing đang ngày càng trở thành yếu tố không thể thiếu cho các doanh nghiệp và cá nhân muốn xây dựng và phát triển thương hiệu trong thời đại công nghệ số. Với nhu cầu nhân lực chuyên nghiệp trong ngành ngày càng cao, các khóa học Digital Marketing được thiết kế để cung cấp kiến thức và kỹ năng từ cơ bản đến nâng cao. Vậy khóa học Digital Marketing bao gồm những nội dung gì? Hãy cùng tìm hiểu!
Phu Tran is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.