二维数组指针打印
1 #include <stdio.h> 2 int main() 3 { 4 5 int nums[5][3] = {{10,20,30},{40,50,60},{70,80,90},{100,110,120},{130,140,150}}; 6 int i,j; 7 8 9 // int (*ptr_nums)[3] = nums; 10 11 for(i = 0; i < 5;i++) 12 { 13 for(j = 0;j < 3;j++) 14 { 15 16 //printf("%d\t",nums[i][j]); //一维数组写法:nums[i] = *(nums + i) 17 // printf("%d\t",*(nums[i]+j) ); 18 printf("%d\t",*(*(nums +i) + j )); 19 } 20 21 printf("\n"); 22 } 23 24 } 25
本文来自博客园,作者:Bytezero!,转载请注明原文链接:https://www.cnblogs.com/Bytezero/p/15072053.html