在C语言中,使用printf函数打印字符串的方法非常简单。首先,需要包含头文件#include<stdio.h>,然后使用双引号将字符串括起来作为printf函数的参数。下面是一个示例:
#include<stdio.h>
int main() {
printf("Hello, World!\n");
return 0;
}
在这个示例中,printf函数会打印出字符串"Hello, World!",并在其后添加一个换行符\n。当运行此程序时,你将看到以下输出:
Hello, World!