Home>Article>Backend Development> What symbols are used to output strings in C language?
#Use double quotes in C language to output strings.
(Recommended tutorial:c language tutorial)
Detailed interpretation:
In C language, there are two functions that can be controlled Output strings on the computer (monitor), they are:
puts(): Output strings and automatically wrap lines. This function can only output strings.
printf(): Outputs a string through the format control character %s, and cannot automatically wrap lines. In addition to strings, printf() can also output other types of data.
For example:
#includeint main(){ char str[] = "http://c.bian"; printf("%s\n", str); //通过字符串名字输出 printf("%s\n", "http://c.bian"); //直接输出 puts(str); //通过字符串名字输出 puts("http://c.bian"); //直接输出 return 0; }
Note that when outputting a string, you only need to give the name, without the following [ ]. For example, the following two ways of writing are wrong:
printf("%s\n", str[]); puts(str[10]);
The above is the detailed content of What symbols are used to output strings in C language?. For more information, please follow other related articles on the PHP Chinese website!