求BYTE *byte数组个数,该如何解决

求BYTE *byte数组个数
BYTE byte[6];
byte[0]=22;
byte[1]=22;
byte[2]=22;
byte[3]=22;
byte[4]=22;
byte[5]=22;
int bLength = sizeof(byte);

为什么上面代码sizeof(byte)返回的是4,这怎么理解?如果我是想求byte数组个数,该怎么求?
byte

------解决方案--------------------
引用:
C/C++ code?1sizeof(byte)
这里byte是数组名,也就是指针,所以sizeof(byte)是4很正常。
你说想求得数组的元素个数,对不起,这个依靠数组指针是无法求解的。
不然所谓的数组越界问题也就不会存在了。


基础不够扎实啊, 朋友.

来自MSDN中的原文:
The operand to sizeof can be one of the following: 

A type name. To use sizeof with a type name, the name must be enclosed in parentheses.

An expression. When used with an expression, sizeof can be specified with or without the parentheses. The expression is not evaluated.

When the sizeof operator is applied to an object of type char, it yields 1. When the sizeof operator is applied to an array, it yields the total number of bytes in that array, not the size of the pointer represented by the array identifier. To obtain the size of the pointer represented by the array identifier, pass it as a parameter to a function that uses sizeof. For example:

------解决方案--------------------
数组传入函数后会被转换为指针。
所以你在函数内sizeof(functionByte);为4,也就是指针的大小。