七月绛雪

  博客园 :: 首页 :: 新随笔 :: 联系 :: 订阅 :: 管理 ::
#include <stdio.h>

static int i=0;

int * Increase()
{
    i
++;
    
return &i;
}


void (* Inc())()
{
    i
++;
    
return Inc;
}


int (*p)() = Inc;

int (* f(int j))()
{
    i
=j;
    
return Increase;
}


void main()
{
    printf(
"\n");
    Increase();        
//i=1;
    (*Increase()) ++;     //i=3;
    printf("%d\n",i);

    (
*Increase()) = 9;    //i=9;
    printf("%d\n",i);

/*-------------------*/

    Inc();
    printf(
"%d\n",i);

    Inc()();    
//但是p()();就错,想不明白
    printf("%d\n",i);
            
//而且Inc()()()...都是错的,为什么啊?!

/*-------------------*/

    f(
9);
    printf(
"%d\n",i);

    f(
9)();
    printf(
"%d\n",i);

}
posted on 2004-11-09 11:49  七月绛雪  阅读(217)  评论(0)    收藏  举报