簡體   English   中英

為什么這段代碼沒有給出任何output,為什么執行沒有終止?

[英]Why doesn't this code give any output, why does the execution not terminate?

每當我在代碼塊中運行這段代碼時,它都會編譯而沒有任何錯誤和警告,但是當我執行它時,它不會顯示任何 output 也不會像我運行的其他代碼那樣自行終止。

#include <stdio.h>
int main ()
{
    int i = 1;
    while (i<=10);

    {
        printf("%d \n",i);
        i = i + 1;
    }
}

由於拼寫錯誤,您創建了一個無限循環:

while (i<=10);

刪除分號。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM