C-了解二维动态阵列的方面大小
我现在在C中实施深度学习。 我想知道具有任何长度的二维动态阵列的水平和垂直长度。
我的尝试:
double** a1 = createArray(?, ?);
size_t a1_size = _msize(*a1)/sizeof(double);
createArray函数:
double** createArray(int l, int m){
double **result;
result = calloc(sizeof(double*), l);
result[0] = calloc(sizeof(double), l * m);
for (int i = 1; i < l; ++i) result[i] = result[i - 1] + m;
return result;
}
我尝试使用_msize函数来解决此问题,但失败了。
您能说出二维动态阵列的水平和垂直尺寸吗?你能帮助我吗?
I am now implementing deep learning in C.
I want to know the horizontal and vertical lengths of the two-dimensional dynamic array created with any length.
My attempt:
double** a1 = createArray(?, ?);
size_t a1_size = _msize(*a1)/sizeof(double);
createArray function:
double** createArray(int l, int m){
double **result;
result = calloc(sizeof(double*), l);
result[0] = calloc(sizeof(double), l * m);
for (int i = 1; i < l; ++i) result[i] = result[i - 1] + m;
return result;
}
I tried to solve this using the _msize function but failed.
Can you tell the horizontal and vertical sizes of the two-dimensional dynamic array? Can you help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论