#include <stdio.h>
int main(){
char* p = NULL;
char s[100] ;
int i = 0;
scanf("%s",s);
p = s;
printf("%s\n",p);
char a ;
int count = 0 ;
while((a = *p++) !='\0'){
if(a ==':'){
count++;
}
}
p = s;
int count1 = 0;
while((a = *p++)!='\0'){
i++;
if(a == ':'){
count1++;
int j ;
for(j = -i; j < -1 ; ++j){
printf("%c",p[j]);
}
printf("\n");
if(count == count1){
printf("%s\n",p);
return 0;
}
i = 0;
}
}
}
C语言字符串处理

本文介绍了一个使用C语言处理字符串的示例程序,该程序演示了如何读取字符串、计数特定字符出现次数,并打印字符串中特定位置的字符。通过这个例子,读者可以了解到基本的字符串操作方法。
1149

被折叠的 条评论
为什么被折叠?



