|
发表于 2020-12-13 14:36:15
|
显示全部楼层
- #include <stdio.h>
- int main(void)
- {
- int a[][5] = {{1000 , 1100 , 1200 , 1300 , 1400} ,\
- {2000 , 2100 , 2200 , 2300 , 2400} ,\
- {3000 , 3100 , 3200 , 3300 , 3400}} ;
- int b[][5] = {{10 , 11 , 12 , 13 , 14} ,\
- {20 , 21 , 22 , 23 , 24} ,\
- {30 , 31 , 32 , 33 , 34}} ;
- int c[3][5] = {0} ;
- int (* p1)[5] = a , (* p2)[5] = b , (* p3)[5] = c ;
- int i , j ;
- for(i = 0 ; i < 3 ; i ++) {
- for(j = 0 ; j < 5 ; j ++) {
- * (* (p3 + i) + j) = *(* (p1 + i) + j) + *(* (p2 + i) + j) ;
- }
- }
- for(i = 0 ; i < 3 ; i ++) {
- printf("%d" , c[i][0]) ;
- for(j = 1 ; j < 5 ; j ++) {
- printf(" , %d" , c[i][j]) ;
- }
- printf("\n") ;
- }
- }
复制代码
编译、运行实况
- D:\00.Excise\C>cl x.c
- 用于 x86 的 Microsoft (R) C/C++ 优化编译器 19.28.29334 版
- 版权所有(C) Microsoft Corporation。保留所有权利。
- x.c
- Microsoft (R) Incremental Linker Version 14.28.29334.0
- Copyright (C) Microsoft Corporation. All rights reserved.
- /out:x.exe
- x.obj
- D:\00.Excise\C>x
- 1010 , 1111 , 1212 , 1313 , 1414
- 2020 , 2121 , 2222 , 2323 , 2424
- 3030 , 3131 , 3232 , 3333 , 3434
- D:\00.Excise\C>
复制代码 |
|