Chinaunix首页 | 论坛 | 博客
  • 博客访问: 314374
  • 博文数量: 199
  • 博客积分: 8610
  • 博客等级: 中将
  • 技术积分: 1975
  • 用 户 组: 普通用户
  • 注册时间: 2006-01-04 19:16
文章分类

全部博文(199)

文章存档

2007年(23)

2006年(176)

我的朋友

分类: C/C++

2006-12-11 14:50:29

/*

 * Test this code and think why it acts as that?

 */

 

#include<stdio.h>

void foo(int b[][3]);

int main(void)
{
    int a[3][3]=
    {
        {1,2,3},
        {4,5,6},
        {7,8,9}
    };
   
    printf("a[2][1] before foo is:%d\n", a[2][1]);
    foo(a);
    printf("a[2][1] after foo is:%d\n", a[2][1]);

    return 0;
}

void foo( int b[][3])
{
    ++b;
    b[1][1]=9;    
}

阅读(554) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~