Generation

generate functionThu, 08 Jun 2023

I need to concatenate records that match or are the same, we will concatenate column E, when column A and column H are the same as the previous record and we will concatenate only the previous record with the one that is the same as the previous record.

int concatenate_records(char last_record[], char current_record[], char buffer[]) { int word_count = 0; int i = 0; //First concatenate the previous and current record, //skipping the first column of the current record. for(i = 0; i < strlen(current_record); ++i) { if(current_record[i] == ',') { word_count++; } if(word_count == 0) continue; buffer[i] = current_record[i]; } //add a comma after the concatenated strings. buffer[i] = ','; //Now, concatenate the last column of the previous record. int buffer_i = i + 1; int last_word = 0; for(i = 0; i < strlen(last_record); ++i) { if(last_record[i] == ',') { last_word++; } if(

Questions about programming?Chat with your personal AI assistant