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

📄 rev_str.c

📁 C和指针非常好的一本书.里面的有许多代码可以借鉴.
💻 C
字号:
/*
** Reverse the string contained in the argument.
*/

void
reverse_string( char *str )
{
	char	*last_char;

	/*
	** Set last_char to point to the last character in the
	** string.
	*/
	for( last_char = str; *last_char != '\0'; last_char++ )
		;

	last_char--;

	/*
	** Interchange the characters that str and last_char point
	** to, advance str and move last_char back one, and keep
	** doing this until the two pointers meet or cross.
	*/
	while( str < last_char ){
		char	temp;

		temp = *str;
		*str++ = *last_char;
		*last_char-- = temp;
	}
}

⌨️ 快捷键说明

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