/* Declare */
char s[] = "qwerrtrhfdbsgfvasdg";
const int fraglen = 3;
/* Parse */
int slen = strlen(s);
int nfrags = (slen + fraglen - 1 ) / fraglen;
char *p[] = malloc(nfrags * sizeof(char*));
int i;
for (i = 0; i < nfrags; i++)
p[i] = strndup(&s[i * fraglen], fraglen);
/* Print */
for (i = 0; i < nfrags; i++)
printf("%d = \"%s\"\n", i, p[i]);
/* Done */
for (i = 0; i < nfrags; i++)
free(p[i]);
free(p);