averagevalue.c
来自「这是一个用TI DSP汇编语言编写的简单的例子程序」· C语言 代码 · 共 26 行
C
26 行
// ****************************************************************
// Description: Library function to determine the
// average value of a integer array. Note this code stresses
// simplicity over robustness and efficiency.
// ****************************************************************
int averageValue( int [], int);
// Requires: array_size equals the number of elements in the array, array_size > 0
// Returns: The average value of the integer array
int averageValue( int values[], int array_size)
{
int total = 0;
int i = 0;
for (i = 0; i < array_size; i++) {
total = total + values[i];
}
return (int)total/array_size;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?