0
点赞
收藏
分享

微信扫一扫

sizeof(p)/sizeof((p)[0])

千行 2023-06-16 阅读 45


// arryLength.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

#define arraysize(p) (sizeof(p)/sizeof((p)[0]))

int main(int argc, char* argv[])
{
	int a[10]={1,2,3,4};

	printf("a:%d\n",arraysize(a));
	printf("a:%d,a[0]=%d\n",sizeof((a)[0]),(a)[0]);

	return 0;
}
/*
a:10
a:4,a[0]=1
Press any key to continue
*/



举报

相关推荐

0 条评论