diff --git a/implementations/C/.gitignore b/implementations/C/.gitignore index 59a897d..2046ae4 100644 --- a/implementations/C/.gitignore +++ b/implementations/C/.gitignore @@ -1 +1,2 @@ joy +parser diff --git a/implementations/C/parser.c b/implementations/C/parser.c new file mode 100644 index 0000000..324af8d --- /dev/null +++ b/implementations/C/parser.c @@ -0,0 +1,23 @@ +#include +#include +#include + +const char *text = "hi there friend"; +/* 01234567890123456789 + ^ ^ +*/ + +int +main(void) +{ + char *rest; + ptrdiff_t diff; + + rest = strpbrk(text, " []"); + while (NULL != rest) { + diff = rest - text; + text = rest; + printf("%ld\n", diff); + rest = strpbrk(++rest, " []"); + } +}