[英]scanf Output not showing of C language in kali terminal
我目前正在kali linux 2020.x中的納米文本編輯器終端中進行C編程。
15 分鍾前,我寫了一個不能正常工作的代碼。 我提到了那個代碼。
#include<stdio.h>
int main(){
int num;
scanf("%d",&num);
printf("number is %d",num);
return 0;
}
我跑了。 一切正常,它也編譯了,但是當我嘗試輸入值並按 Enter 鍵時,output 為空白/沒有 output。
我不知道你是否有答案,但我試了一下你的問題並做了這個:
int main()
{
int m_iValue = 0;
scanf( "%i", &m_iValue );
{
char m_szBuffer[128]; // Note: We got a BIG buffer boy!
sprintf( m_szBuffer, "Value: %i \n", m_iValue );
printf( m_szBuffer );
}
return 0;
}
它工作得很好; 希望能幫助到你!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.