How to output strings in the C language?

In C language, we can use the printf function to display strings.

For example.

#include <stdio.h>

int main() {
    char str[] = "Hello, World!";
    printf("%s\n", str);
    return 0;
}

The output result is:

Hello, World!

Use the %s format specifier in the printf function to output a string.

bannerAds