What is the problem with this code sample? I get either I segmentation fault, or program continues to run infinitely.
const char* prefix = "gender_";
char sex[8];
int id;
for(id=0; id <= 9 id++)
{
sprintf(id_string, "%i", id); //converts int id to string id
strcpy(sex, prefix);
strcat(sex, id)
}
//sex should look something like this: gender_1, gender_2, gender_3 ... gender_9