当前位置:网站首页>6-1 how many words are needed to form a sentence?
6-1 how many words are needed to form a sentence?
2022-06-11 17:37:00 【Tomatoes_ Menon】
This question requests to realize a function , Count the number of words in a string .
Function interface definition :
int fun ( char *s );Sample referee test procedure :
Here is an example of a function being called for testing . for example :
#include <stdio.h>
int fun ( char *str );
int main()
{
char str[20];
gets(str);
printf("%d",fun(str));
return 0;
}
/* Please fill in the answer here */sample input :
how are you
sample output :
3int fun ( char *s )
{
int count=0;
int i=0;
while(s[i]){
if(s[i]==' ')
count++;
i++;
}
return count+1;
}
边栏推荐
- 6-1 read string (*) from file
- Authing CEO 谢扬入选福布斯 2021 年 30 Under 30 亚洲榜单
- 开源项目那么多,这次带你了解个版本的区别,明白alpha版、beta版、rc版是什么意思
- Authing 双周动态:Authing 论坛上线(4.25-5.8)
- Service学习笔记01-启动方式与生命周期
- Mathematical basis of information security Chapter 2 - congruence
- 6-2 多个整数的逆序输出-递归
- TiDB-unsafe recover(tikv宕机数大于等于一半副本数)
- CentOS7服务器配置(四)---安装redis
- Foreach traverses collections and collection containers
猜你喜欢

Test and analysis of tidb write hotspot

adb 命令学习笔记

Authing 双周动态:应用市场上线(5 .10 —5 .22 )

Service学习笔记01-启动方式与生命周期

删除链表的倒数第N个节点---2022/02/22

Authoring share | understanding saml2 protocol

Valid parentheses ---2022/02/23

通过Xshell连接有跳板机/堡垒机的服务器

使用exe4j 将.jar文件打包为.exe文件

Xie Yang, CEO of authing, was selected into Forbes' 30 under 30 Asia list in 2021
随机推荐
What subclasses inherit, polymorphism, and upward transformation
Set object mapping + scene 6-face mapping + create space in threejs
Service learning notes 03 front desk service practice
Valid parentheses ---2022/02/23
TiDB-unsafe recover(tikv宕机数大于等于一半副本数)
What problems are exposed when all Sohu employees are cheated?
搜狐全员遭诈骗,暴露哪些问题?
通过Xshell连接有跳板机/堡垒机的服务器
Test and analysis of tidb write hotspot
【深度学习基础】神经网络的学习(3)
R language mice package error in terms Formula (TMP, simplify = true): the model formula in extractvars is incorrect
There are so many open source projects. This time, I'll show you the differences between different versions and understand the meaning of alpha version, beta version and RC version
05_特征工程—降维
[online problem] timeout waiting for connection from pool
6-7 文件读写操作
How to become an optimist organization?
which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_ mod
6-3 批量求和(*)
Typescipt Basics
7-2 h0107. Pig-Latin