Anonymous v2
public c v1 · immutable#include <stdio.h>#include <regex.h>int main(){ char string[100]; int word=0; char *cp; printf("Enter a string\nString: "); fgets(string,sizeof(string),stdin); cp = string; ret = regcomp( &re, "\\<\\w+\\>", REG_EXTENDED ); // TODO check ret ret = regexec( &re, cp, 1, &pm, 0); while (ret == 0) { word++ cp += pm.rm_eo; ret = regexec( &re, cp, 1, &pm, REG_NOTBOL); } regfree(&re); printf("yeah %d words\n"word); return 0;}