【发布时间】:2014-01-02 04:32:46
【问题描述】:
首先我应该说我的 C 经验很少,当我说的很少时,我的意思是大约 2 1/2 小时。因此,请原谅并纠正任何不准确、愚蠢或其他个人失误。
这是目前的代码:
typedef struct
{
float n;
int x;
int y;
int values[5];
} Cell;
typedef Cell Grid[10][10];
void update(Grid *source)
{
// This should be a 2D array of Cells.
// All the values in the Cell should be 0,
// including the contents of the values array.
Grid grid;
}
更新将被相当频繁地调用,并且对性能有一定的要求,因此如果需要为了性能,我愿意牺牲一些可读性/简单性/编码时间。不,这不是过早的优化。
感谢您的帮助,
山姆。
【问题讨论】:
标签: c arrays performance struct