第15周 oj Problem C: 字符串逆序输出
问题及代码: /*Copyright(c)2016,烟台大学计算机学院 all rights reserved. 作者:曹欣宇 完成日期:2016年12月12日 题目描述 编写一个函数,功能是使输入的字符串逆序输出 输入 输入一串字符串,注意字符串中不要有空格。 输出 输出该字符串的逆序。 样例输入 ABCDEFG 样例输出 GFEDCBA*/ #include<stdio.h> #include<string.h> int main() { char str[100]; scanf("%s",str); int len; len=strlen(str); int fuction(char *, int); fuction(str,len); return 0; } int fuction(char * str, int len) { int i; for(i=len-1;i>=0;i--) { printf("%c",str[i]); } return 0; } 运行结果: 知识点总结: 通过学习,复习了函数的使用,并学会了使用strlen函数求字符串长度。 学习心得: 此题不难,主要是熟悉strlen函数 来源: CSDN 作者: 青藤麻瓜、 链接: https://blog.csdn.net/cxy201658503125/article/details/53586144