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

📄 memrev.c

📁 Many C samples. It is a good sample for students to learn C language.
💻 C
字号:
/*  File   : memrev.c
    Author : Richard A. O'Keefe.
    Updated: 1 June 1984
    Defines: memrev()

    memrev(dst, src, len)
    moves len bytes from src to dst, in REVERSE order.  NUL characters
    receive no special treatment, they are moved like the rest.  It is
    to strrev as memcpy is to strcpy.

    Note: this function is perfectly happy to reverse a block into the
    same place, memrev(x, x, L) will work.
    It will not work for partially overlapping source and destination.
*/

#include "strings.h"

void memrev(dsta, srca, len)
    register char *dsta, *srca;
    int len;
    {
	register char *dstz, *srcz;
	register int t;

	if (len <= 0) return;
	srcz = srca+len;
	dstz = dsta+len;
	while (srcz > srca) {
	    t = *--srcz;
	    *--dstz = *srca++;
	    *dsta++ = t;
	}
    }

⌨️ 快捷键说明

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