c_cpp C中的字符串匹配对象方法

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c_cpp C中的字符串匹配对象方法相关的知识,希望对你有一定的参考价值。

// Prototyping for match utilities for C library

typedef struct
{
	size_t len;
	size_t state; // indicates to what portion a match is made.
	char string[0];
} Pattern;

Pattern* Pattern_new(const char* string)
{
	size_t sizedStr = strlen(string);
	Pattern* newpat = malloc(sizeof(Pattern) + sizedStr);
	newpat->len = sizedStr;
	newpat->state = 0;
	return newpat;
}

以上是关于c_cpp C中的字符串匹配对象方法的主要内容,如果未能解决你的问题,请参考以下文章