if         数组名直接作为参数压栈
then     sizeof(数组名) = 一个指针所占字节数
else     sizeof(数组名) = 数组所占字节数
测试程序如下:
typedef struct{
    
char array[32];
}node_t;

void
 fun1(node_t    node)
{
    printf(
"%d\n"sizeof(node.array));
}

void fun2(char array[32])
{
    printf(
"%d\n"sizeof(array));
}

int main(void)
{
    node_t  node;
    fun1(node); // indirect
    fun2(node.array); // direct

    
return 0;
}
程序的输出是:
32
4
posted on 2007-09-07 23:19  MainTao  阅读(2139)  评论(1编辑  收藏  举报