![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串
山野雾灯ccc
路漫漫其修远兮,吾将上下而求索。
展开
-
结构体实现统计字符串中数字,字母,其他字符的数量
struct num{ int Letnum; int Dignum; int Othernum;};struct num Print_Num(){ struct num num_s={0,0,0}; char ch = '\0'; while((ch = getchar()) != '\n') { if(isalpha(ch)) { num_s.Letnum += 1; }else if(isdigit(ch)) { num_s.Dignum +=..原创 2020-07-17 16:44:56 · 424 阅读 · 0 评论 -
字符串和数组的区别,长度、所占空间计算和比较
char str1[10]={"helllo"}; char str2[10]={'h','e','l','l','o'}; char str3[]={"hello"}; char str4[]={'h','e','l','l','o'}; printf("sizeof(str1):%d strlen(str1):%d\n",sizeof(str1),strlen(str1)); printf("sizeof(str2):%d strlen(str2):%d\n",sizeof(.原创 2020-06-11 22:03:16 · 3702 阅读 · 0 评论 -
统计字符串中单词的个数。
C语言实现统计字符串中单词的个数。#include<stdio.h>#include<ctype.h>int main(){ char str[] = { "I am a student wear" }; int i = 0; int sum = 0; int num = 0; for (i = 0; str[i] != '\0'; i++) ...原创 2020-02-20 21:13:18 · 212 阅读 · 0 评论