为什么该命令一次获得一个值?

    while (1){
        scanf("%c", &input);
            if((input>='a')&&(input<='z')) {
                count[input-'a']++;
            }
            else if((input>='A')&&(input<='Z')) {
                count[input-'A']++;
            }
            else {
                break;
            }
    }

为什么该命令一次获得一个值? while(1)代表无限循环吗?

评论
  • ad_est
    ad_est 回复

    break causes the loop to break thus not running again.

    Remove it so the while loop will occur again.

  • 闷油瓶
    闷油瓶 回复

    break exit a while whatever the condition in the while.

    You did not show what you input in the question. However according to the behaviour you observe, it's not a letter or a uppercase letter, thus you end up breaking the while.