The following C code iterates over the characters of a string. I’ve never thought to write code this way, but of course you can.
#include <stdio.h> int main() { const char *text = "testtest"; int n = 0; int i; for (i=0; text[i] != '\0'; ++i) { n++; } printf("%d\n", n); }
Source: Wikipedia