⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 reverse.c

📁 The art and science of c_source code!
💻 C
字号:
/* * File: reverse.c * --------------- * This file defines the function ReverseString(str), * which returns str with its characters reversed. */#include <stdio.h>#include "genlib.h"#include "strlib.h"#include "simpio.h"/* Function prototypes */string ReverseString(string str);/* Main program */main(){    string str;    printf("Enter a string: ");    str = GetLine();    printf("\"%s\" backwards is \"%s\"\n", str, ReverseString(str));}/* * Function: ReverseString * Usage: newstr = ReverseString(str); * ----------------------------------- * Returns a new string consisting of the characters in * str in reverse order. */string ReverseString(string str){    string result;    int i;    result = "";    for (i = 0; i < StringLength(str); i++) {        result = Concat(CharToString(IthChar(str, i)), result);    }    return (result);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -