[C]指针练习-3

发表于:2007-05-26来源:作者:点击数: 标签:
#define FORMAT %d,%d,%d,%d main() { static int a[3][4]=; printf(1,3,5,7,9,11,13,15,17,19,21,23); printf(a,*a,*(a),*(*a)); printf(FORMAT,a,*a,*(a),*(*a)); printf(a[0],*(a+0),*(a[0]),*(*(a+0))); printf(FORMAT,a[0],*(a+0),*(a[0]),*(*(a+0)));

#define FORMAT "%d,%d,%d,%d "
main()
{
static int a[3][4]=;
printf("1,3,5,7,9,11,13,15,17,19,21,23 ");

printf("a,*a,*(a),*(*a) ");
printf(FORMAT,a,*a,*(a),*(*a));

printf("a[0],*(a+0),*(a[0]),*(*(a+0)) ");
printf(FORMAT,a[0],*(a+0),*(a[0]),*(*(a+0)));

printf("&a[0],&a[0][0],*(&a[0]),*&a[0][0] ");
printf(FORMAT,&a[0],&a[0][0],*(&a[0]),*&a[0][0]);

printf("&a[1],a+1,*(&a[1]),*(a+1) ");
printf(FORMAT,&a[1],a+1,*(&a[1]),*(a+1));

printf("&a[1][0],*(a+1)+0,*&a[1][0],*(*(a+1)+0) ");
printf(FORMAT,&a[1][0],*(a+1)+0,*(&a[1][0]),*(*(a+1)+0));

printf("a[2],*(a+2),*(a[2]),*(*(a+2)) ");
printf(FORMAT,a[2],*(a+2),*(a[2]),*(*(a+2)));

printf("&a[2],a+2,*&a[2],*(a+2) ");
printf(FORMAT,&a[2],a+2,*&a[2],*(a+2));

printf("a[1][0],*(*(a+1)+0),a[1][0] ");
printf(FORMAT,a[1][0],*(*(a+1)+0),a[1][0]);
}

原文转自:http://www.ltesting.net

评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)