阅读背景:

根据条件动态分配内存或在堆栈上分配内存(if语句)

来源:互联网 

I have a C program in which an array of floats has its elements accessed quite often for the duration of the program. The size of the array depends on an argument that a user will input and therefore will vary. Generally, the size will be small enough (~ 125 elements) so that the memory of the array can be placed on the stack and thus allocation and accessing it will be faster. But in rare cases, the array may be large enough such that it requires dynamic allocation. My initial solution for this was the following:I have a C program in which an array of floats




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: