How to output strings in the C programming language?

In C language, you can use the printf function to display strings. Here is a simple example:

#include <stdio.h>

int main() {
    char str[] = "Hello, World!";

    printf("%s\n", str); // 输出字符串

    return 0;
}

In the printf function, use the format string “%s” to print out a string, and then pass the string to be printed as a parameter to the printf function.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds