unsigned short int myFunc(unsigned char *ptr)
{
Unsigned int TL;
TL= *ptr+*(ptr+1);
Return TL
}
Main
{
unsigned char data[10]={10,11,12,14,15,15,45};
unsigned int da;
da= myFunc(data)--------其中data 为data数组的首地址,那么da应该等于10+11=21
}
怎样在一个子函数中处理一个数组,能不能写个示例!!
下面的例子怎样用宏怎样写
sub unsigned int myFunc(unsigned char source[i],unsigned char len )
{
unsigned int TL
TL= source[0]+source[1]+source[2]+......source[len-1]
Return TL
}
main
unsigned char data[5]={1 , 2,3,4,5}
unsigned int TT
TT=(data[0],5)