There are too many things wrong with your code...as far as the segfaulting its because you are attempting to add on more to the string than the string is large...you're doing a strcat for every letter in string, which is defined as 4096, the bowling buffer is also 4096 and you're catting on a string that is like 20+ chars in length so you're easily going over..

Now I don't know what you're trying to accomplish with these strncmp's you're running.....first of all strncmp compares two STRINGS, ie you pass it 2 char * pointers pointing to a buffer of characters terminating in a \0.

When you say string[j] that is a "char" you need to pass a "char *" which is just: "string". Thats just at first glance, I'm sure there are more problems.