#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <time.h>
#include <ctype.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <signal.h>
#include <pthread.h>
#include <errno.h>
int func1( char buf[][10] )
{
printf("buf addr = %p\n" , buf);
printf("buf addr = %p\n" , buf[0]);
printf("buf[0] = %s\n" , buf[0]);
printf("buf[1] = %s\n" , buf[1]);
}
int func2( char buf[][2] )
{
printf("buf addr = %p\n" , buf);
printf("buf addr = %p\n" , buf[0]);
printf("buf[0] = %s\n" , buf[0]);
printf("buf[1] = %s\n" , buf[1]);
}
int func3( char (*buf)[10] )
{
printf("buf addr = %p\n" , buf);
printf("buf addr = %p\n" , buf[0]);
printf("buf[0] = %s\n" , buf[0]);
printf("buf[1] = %s\n" , buf[1]);
}
int func4( char **buf )
{
printf("buf addr = %p\n" , buf);
printf("buf addr = %p\n" , buf[0]);
printf("buf[0] = %s\n" , buf[0]);
printf("buf[1] = %s\n" , buf[1]);
}
int func5( char *buf[10] )
{
printf("buf addr = %p\n" , buf);
printf("buf addr = %p\n" , buf[0]);
printf("buf[0] = %s\n" , buf[0]);
printf("buf[1] = %s\n" , buf[1]);
}
int main()
{
char buf[10][10];
strcpy( buf[0] , "123" );
strcpy( buf[1] , "456" );
//func1( buf );
//func2( buf );
//func3( buf );
//func4( buf );
func5( buf );
return 0;
}
总结来说二维数组也是一级指针