Im trying to get the operands from argv to print vertically. for some reason, after it gets to the end of an operand, it starts to print the next operand.
Code:
int col= 0, maxlength = 0, row= 0;
for(col = optind; col < argc; col++){
if(maxlength < strlen(argv[col])){
maxlength = strlen(argv[col]);
}
}
char c;
for(row = 0; row < maxlength; row++){
for(col = optind; col < argc; col++){
if (row < strlen(argv[col])){
c = argv[col][row];
argv[col][row]=c;
putchar(argv[col][row]);}
else{
argv[col][row]=' ';
putchar(' ');}
}
putchar('\n');
}
}