第1个回答 2019-02-22
用标准c库中的字符串操作函数就可以了
需要#include
"string.h"
常用的函数有strcpy,strlen,strcmp,strchr,strstr等等
第2个回答 推荐于2017-10-11
要include <string>
定义一个字符串 string s = "asd";
获取字符直接用 s[0]就行了本回答被提问者采纳
第3个回答 2010-04-20
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
char s[] = "abcde";
int n = strlen(s);
int i;
for( i=0; i<n; i++ )
{
putchar(s[i]);
}
return 0;
}
第4个回答 2010-04-18
使用数组下标或者指针
比如p[1]或者*(p+1)等