二维指针应用示例

#include<stdio.h>
  2 int sort_two_array(int **buff,int num)
  3 {
  4         int i=0;int j=0;int temp;
  5         int *pload=*(buff+0);
  6         for(i=0;i<3*5;i++)
  7         {
  8                 for(j=0;j<15-i-1;j++)
  9                 {
 10                         if(pload[j]>pload[j+1])
 11                         {
 12                                 temp=pload[j];
 13                                 pload[j]=pload[j+1];
 14                                 pload[j+1]=temp;
 15                         }
 16                 }
 17         }
 18 }
 19 int show_two_array(int **array,int num)
 20 {
 21         int i=0,j=0;
 22         int *pload=*(array+0);
 23         for(i=0;i<3;i++)
 24         {
 25                 for(j=0;j<5;j++)
 26                 {
 27                         printf("%4d",pload[5*i+j]);
 28                 }
 29                 printf("\n");
 30         }
 31 }
 32 int initial_two_array( int **array,int num)
 33 {
 34         int i=0,j=0;
 35         for(i=0;i<3;i++)
 36         {
 37                 for(j=0;j<5;j++)
                 {
 39                         scanf("%d",*(array+i)+j);
 40                 }
 41                 printf("\n");
 42         }
 43 }
 44 int main(void)
 45 {
 46         int load[3][5];
 47         int *pload[]={*load,*(load+1),*(load+2)};
 48         initial_two_array(pload,3);
 49         sort_two_array(pload,3);
 50         show_two_array(pload,3);
 51         return 1;
 52 }

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值