[英]C hello world program is crashing on variable output
首先,我來自ac#背景,所以我對中間編程有一定的了解。
這是我的第一個C程序,當我嘗試打印變量“ testtt”時,它崩潰了。
#include <stdio.h>
#include <stdlib.h>
int main()
{
char testtt = "Hello world";
//scanf("%s", &test);
printf(testtt);
return 0;
}
char
僅包含一個字符。 使用char testtt[] = "Hello world";
更改
char testtt = "Hello world";
至
char testtt[] = "Hello world";
我認為printf也應該是:
printf("%s", testtt);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.