⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 averagevalue.c

📁 基于DSP2000的例程
💻 C
字号:
/*
 *  Copyright (c) 2001-2002, Texas Instruments Incorporated.
 *  All rights reserved. Property of Texas Instruments Incorporated.
 *  Restricted rights to use, duplicate or disclose this code are
 *  granted through contract.
*/

/*
 *  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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -