C言語で文字列を出力するにはどうしますか?

C言語では、文字列を出力するためにprintf関数を使用できます。

たとえば、”Hello World!”文字列を出力したい場合、次のコードを使用できます。

#include <stdio.h>

int main() {
    printf("Hello World!");
    return 0;
}

プログラムを実行すると、結果が出力されます。

Hello World!

printf関数において、ダブルクォーテーションで括った内容は、文字列を表します。具体的な文字列を出力するには、printf関数の括弧内に文字列を記述すればよい。

bannerAds