当前位置:网站首页>指针 --按字符串相反次序输出其中的所有字符
指针 --按字符串相反次序输出其中的所有字符
2022-07-06 09:24:00 【|光|】
要求
编写程序,输入一个字符串,按相反次序输出其中的所有字符。(用指针实现)
代码
/* * 该函数实现对字符串a的反序操作,如原始字符串为string,反序后为gnirts, * 请反序后的字符串仍然存放在a所指向的内容中 */
void reverse(char *a)
{
int n = strlen(a);
int b[n],c = 0;
for(int i = n-1;i>=0;i--)
{
b[c] = a[i];
c++;
}
for(int i = 0;i<n;i++)
{
a[i] = b[i];
}
}
main函数
int main()
{
char a[200];
gets(a);
reverse(a);
puts(a);
return 0;
}
测试
测试输入
I am a student
输出
tneduts a ma I
边栏推荐
- 《统计学》第八版贾俊平第八章假设检验知识点总结及课后习题答案
- {1,2,3,2,5}查重问题
- 【指针】求二维数组中最大元素的值
- Sentinel overall workflow
- Statistics 8th Edition Jia Junping Chapter 14 summary of index knowledge points and answers to exercises after class
- 攻防世界MISC练习区(SimpleRAR、base64stego、功夫再高也怕菜刀)
- JDBC transactions, batch processing, and connection pooling (super detailed)
- 《统计学》第八版贾俊平第九章分类数据分析知识点总结及课后习题答案
- Windows platform mongodb database installation
- 数据库多表链接的查询方式
猜你喜欢

Intranet information collection of Intranet penetration (2)

Intranet information collection of Intranet penetration (4)

网络基础详解

JDBC transactions, batch processing, and connection pooling (super detailed)
![Harmonyos application development -- address book management system telmanagesys based on listcontainer [phonebook][api v6]](/img/0b/ddbee0b8a34627e13bff5598bbaed8.jpg)
Harmonyos application development -- address book management system telmanagesys based on listcontainer [phonebook][api v6]

Low income from doing we media? 90% of people make mistakes in these three points

记一次edu,SQL注入实战

《统计学》第八版贾俊平第九章分类数据分析知识点总结及课后习题答案

《统计学》第八版贾俊平第十四章指数知识点总结及课后习题答案

JDBC看这篇就够了
随机推荐
Binary search tree concept
JDBC transactions, batch processing, and connection pooling (super detailed)
ES全文索引
Network layer - simple ARP disconnection
Intranet information collection of Intranet penetration (3)
攻防世界MISC练习区(gif 掀桌子 ext3 )
Intranet information collection of Intranet penetration (2)
Data mining - a discussion on sample imbalance in classification problems
Detailed explanation of three ways of HTTP caching
Network technology related topics
记一次api接口SQL注入实战
Statistics 8th Edition Jia Junping Chapter 10 summary of knowledge points of analysis of variance and answers to exercises after class
{1,2,3,2,5}查重问题
7-7 7003 combination lock (PTA program design)
How to test whether an object is a proxy- How to test if an object is a Proxy?
《统计学》第八版贾俊平第五章概率与概率分布
Statistics, 8th Edition, Jia Junping, Chapter VIII, summary of knowledge points of hypothesis test and answers to exercises after class
搭建域环境(win)
外网打点(信息收集)
《統計學》第八版賈俊平第七章知識點總結及課後習題答案