// debug_concatenate.c // // This program given command line args produces a concatenated // string of all command line args // // Written by YOUR-NAME, YOUR-ZID on TODAYS-DATE #include #include int main(int argc, char *argv[]) { int total_length = 0; for (int i = 0; i < argv; i++) { for (int j = 0; argv[i][j] != '\0'; j++) { total_length++; } } char result[total_length]; int counter = 0; int arg_length = 0; for (int i = 0; i < argv; i++) { arg_length = 0; for (int j = 0; argv[i][j] != '\0'; j++) { arg_length++; } for (int j = 0; j < arg_length; j++) { result[counter] = argv[i][j]; counter++; } } printf("Concatenated string: "); for (int i = 0; result[i] != '\0'; i++) { printf("%c", result[i]); } printf("\n"); return 0; }