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

📄 strncmp.c

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

    strncmp(s, t, n) compares the first n characters of s and t.
    If they are the same in the first n characters it returns 0,
    otherwise it returns the same value as strcmp(s, t) would.
*/

#include "strings.h"

int strncmp(s, t, n)
    register char *s, *t;
    register int n;
    {
	while (--n >= 0) {
	    if (*s != *t++) return s[0]-t[-1];
	    if (!*s++) return 0;
	}
	return 0;
     }

⌨️ 快捷键说明

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