由于大家的基础还不够,这里暂时不深入探讨,大家暂时记住即可,我们会在《C语言指针》一节中详细介绍。字符串使用示例:#include#includeint main() { char c = '@'; char *str = "This is a string."; printf("char: %c\n", c); printf("string1: %s\n", str); //也可以直接输出字符串 printf("string2: %s\n", "This is another string."); system("pause"); return 0; }运行结果:
char: @
string1: This is a string.
string2: This is another string.