This is wrong:
for(i=1;i<=len;++i) {
for(j=1;j<=i;++j) {
printf("%c",stringArray[counter]);
counter++;
}
printf("\n");
}
You can't increment counter so many times. Because of the nested loops, counter
will access out of bounds positions - you are incrementing it towards a final value that is O(n^2) with relation to the string's length.