二维数组作为形参

二维数组作为形参demo

#include 
#include 

int fun(char (*a)[32])
{	
	printf("enter fun\n");
	int i=0;

	for(i=0; i < 32; i++)
		printf("a[%d]=%s\n",i, a[i]);
	return 0;
}
int main(int argc, char *argv[])
{
	char a[32][32] = {0};
	char buffer[32] = {0};
	int i = 0;
	for (i=0; i < 32; i++)
	{
		sprintf(buffer,"aa:bb:cc:dd:11:%02d", i);
		strcpy(a[i], buffer);
		printf("a[%d]=%s\n", i, a[i]);
	}
	fun(a);
	return 0;
}


你可能感兴趣的:(linux,c,linux,c)