code helping you to understand function stack

635阅读 0评论2006-12-11 jeffshia
分类:C/C++

See the differences of the following three pieces of code and test them in both VC6.0 and gcc.
 

#include<stdio.h>

int main()
{
    int x,y,z;
    int i;
    int a[16];


    for(i=0;i<=16;i++)
    {
        a[i]=0;
        printf("%d",i);
    }

    return 0;
}

 

#include<stdio.h>

int main()
{
    int x,y,z;
    int a[16];
    int i;

    for(i=0;i<=16;i++)
    {
        a[i]=0;
        printf("%d",i);
    }

    return 0;
}

 

#include<stdio.h>

int main()
{
    int i;
    int a[16];

    for(i=0;i<=16;i++)
    {
        a[i]=0;
        printf("%d",i);
    }

    return 0;
}

上一篇:12.7 日跑步日记
下一篇:思考一段关于多维数组的程序