C 练习实例42

C语言教程评论

C 练习实例42

题目:学习使用auto定义变量的用法。

程序分析:无。文章源自公式库网-https://www.gongshiku.com/html/202112/c-lianxishili42.html

#include <stdio.h>
int main()
{
    int i,num;
    num=2;
    for(i=0;i<3;i++)
    {
        printf("num 变量为 %d \n",num);
        num++;
        {
            auto int num=1;
            printf("内置模块 num 变量为 %d \n",num);
            num++;
        }
    }
    return 0;
}

以上实例输出结果为:文章源自公式库网-https://www.gongshiku.com/html/202112/c-lianxishili42.html

num 变量为 2 
内置模块 num 变量为 1 
num 变量为 3 
内置模块 num 变量为 1 
num 变量为 4 
内置模块 num 变量为 1
文章源自公式库网-https://www.gongshiku.com/html/202112/c-lianxishili42.html文章源自公式库网-https://www.gongshiku.com/html/202112/c-lianxishili42.html
运营不易,
感谢支持!
weinxin
我的微信
我的微信公众号
我的微信公众号扫一扫
weinxin
我的公众号
 最后更新:2021-12-7
公式库网
  • 本文由 公式库网 发表于 2021年12月6日20:28:42
  • 转载请务必保留本文链接:https://www.gongshiku.com/html/202112/c-lianxishili42.html

发表评论