strmax.c

来自「[随书类]Dos6.0源代码」· C语言 代码 · 共 36 行

C
36
字号
/***************************************************************************/
/*																									*/
/*	STRMAX.C																						*/
/*																									*/
/*		Copyright (c) 1991 - Microsoft Corp.											*/
/*		All rights reserved.																	*/
/*		Microsoft Confidential																*/
/*                                                                         */
/* Returns the length of the longest string in an array of strings.			*/
/*                                                                         */
/* unsigned MaxStrLen( char *Strings[] )												*/
/* 																								*/
/* ARGUMENTS:	Strings - array of pointers to strings								*/
/* RETURNS: 	unsigned - length of the longest string in the array			*/
/* 																								*/
/* johnhe - 03/23/89																			*/
/***************************************************************************/

#include    <stdio.h>
#include 	<string.h>

unsigned MaxStrLen( char **Strings )
{
	register 		i;
	unsigned 		Len;
	unsigned 		MaxLen;

	for ( i = MaxLen = 0; Strings[i] != NULL; i++ )
	{
		Len = strlen( Strings[i] );
		if ( Len > MaxLen )
			MaxLen = Len;
	}
	return( MaxLen );
}

⌨️ 快捷键说明

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