- 2
- 0
- 约2.35千字
- 约 7页
- 2023-08-22 发布于海南
- 举报
C、C++字符串指针(指向字符串的指针)
C、C++字符串指针(指向字符串的指针)
C语言中没有特定的字符串类型,我们通常是将字符串放在一个字符数组中,这里我们来演示一下:
#include stdio.h
#include string.h
#include iostream
int main(){
char str[] = hello world!;
int len = strlen(str), i;
//直接输出字符串
printf(%s\n, str);
//每次输出一个字符
for(i=0; ilen; i++){
printf(%c, str[i]);
}
printf(\n);
原创力文档

文档评论(0)