自动类型变量auto和静态变量static学习

#include <stdio.h>
int fun1();   /*function one declaration*/
int fun2();   /*functino two declaration*/
void main()
{
    int i;
    for (i = 1; i <= 5; i++)
    {
        printf("fun1()=%2d,",fun1());/*call function one*/
        printf("fun2()=%2d\n",fun2());/*call function two*/
    }
}
/*-------------define function one----------------*/
int fun1()
{
    auto int y = 10;   /*define the auto variable y*/
    y += 1;
    return y;
}
/*--------------define function two---------------*/
int fun2()
{
    static int z = 60;/*define the static variable z*/
    z += 1;
    return z;
相关文章
相关标签/搜索