当前位置:网站首页>Pointer -- output all characters in the string in reverse order
Pointer -- output all characters in the string in reverse order
2022-07-06 14:35:00 【|Light|】
requirement
Programming , Enter a string , Output all characters in reverse order .( Use a pointer to achieve )
Code
/* * This function implements string a Reverse operation of , If the original string is string, Reverse order followed by gnirts, * Please store the string after reverse order in a In what it points to */
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 function
int main()
{
char a[200];
gets(a);
reverse(a);
puts(a);
return 0;
}
test
Test input
I am a student
Output
tneduts a ma I
边栏推荐
- 指针--剔除字符串中的所有数字
- 指针 --按字符串相反次序输出其中的所有字符
- sqqyw(淡然点图标系统)漏洞复现和74cms漏洞复现
- Statistics 8th Edition Jia Junping Chapter IX summary of knowledge points of classified data analysis and answers to exercises after class
- 网络基础详解
- Function: string storage in reverse order
- 【指针】求字符串的长度
- 数字电路基础(一)数制与码制
- 内网渗透之内网信息收集(四)
- 【指针】数组逆序重新存放后并输出
猜你喜欢

Sqqyw (indifferent dot icon system) vulnerability recurrence and 74cms vulnerability recurrence

关于超星脚本出现乱码问题

Record once, modify password logic vulnerability actual combat

Internet Management (Information Collection)

Xray and burp linkage mining

图书管理系统

MySQL中什么是索引?常用的索引有哪些种类?索引在什么情况下会失效?

《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案

《统计学》第八版贾俊平第四章总结及课后习题答案

Ucos-iii learning records (11) - task management
随机推荐
Network technology related topics
攻防世界MISC练习区(gif 掀桌子 ext3 )
线程的实现方式总结
指针:最大值、最小值和平均值
MySQL learning notes (stage 1)
Low income from doing we media? 90% of people make mistakes in these three points
2022华中杯数学建模思路
Binary search tree concept
Based on authorized access, cross host, and permission allocation under sqlserver
Hackmyvm target series (2) -warrior
Statistics 8th Edition Jia Junping Chapter XIII Summary of knowledge points of time series analysis and prediction and answers to exercises after class
What language should I learn from zero foundation. Suggestions
《統計學》第八版賈俊平第七章知識點總結及課後習題答案
Applet Web Capture -fiddler
Pointeurs: maximum, minimum et moyenne
【指针】删除字符串s中的所有空格
指针 --按字符串相反次序输出其中的所有字符
Statistics 8th Edition Jia Junping Chapter 10 summary of knowledge points of analysis of variance and answers to exercises after class
Statistics 8th Edition Jia Junping Chapter 7 Summary of knowledge points and answers to exercises after class
Web vulnerability - File Inclusion Vulnerability of file operation