鱼C论坛

 找回密码
 立即注册
查看: 4387|回复: 3

不懂为什么有初值和没有赋初值的区别!!

[复制链接]
发表于 2013-4-4 14:52:20 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main()
{
        int i=0;
    char c;
    while(1)
    {
       c=0
        while(c!=13&&c!=27)
      {  
        c=getch();
        printf("%c\n",c);     
      }
     if(c==27)
       break;
       i++;
       printf("The No.is %d\n",i);
       getch();
    }

上例我给c赋初值和不给c赋初值有区别,不了解!!求解!!

小甲鱼最新课程 -> https://ilovefishc.com
发表于 2013-4-4 20:23:15 | 显示全部楼层
一样不很懂,不过查了下ASCII表,13表示归位键,27表示ESC键,是什么意思?
小甲鱼最新课程 -> https://ilovefishc.com
 楼主| 发表于 2013-4-5 19:10:36 | 显示全部楼层

.....这个程序你看懂?看懂应该明白其中的意思啊!!!!你怎么反问我呢...
小甲鱼最新课程 -> https://ilovefishc.com
发表于 2013-4-6 20:03:53 | 显示全部楼层
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
int main()
{
        int i=0;
    char c;
    while(1)
    {
       c=0;/*没有付初值,c的值是任意的,有可能是ASCII表中的13或27,这样以下程序代码就没用了*/
        while(c!=13&&c!=27)
      {  
        c=getch();
        printf("%c\n",c);     
      }
     if(c==27)
       break;
       i++;
       printf("The No.is %d\n",i);
       getch();
    }
}
小甲鱼最新课程 -> https://ilovefishc.com
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-8-4 15:37

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表