In the following code, the printed result for char array dir is gibberish.
However, if I comment out the indicated printf statement, the printed result is intelligible. What is going on here? Thanks. sing code blocks / gcc.
#include <stdio.h>
#include <string.h>
char* handle_input(int argc,char *argv[]){
    char dir[200];
    printf("Number of arguments: %d\n",argc);
    if(argc<2) {
       printf("No argument specified\n");
       strcpy(dir,"Default argument");
    }
    else{
        printf("Command line directory was specified\n");
        ++argv;
        strcpy(dir,argv[0]);
    }
    strcat(dir,"_CAT");
    return dir;
}
int main(int argc, char *argv[]){
    char* dir;
    dir = handle_input(argc,argv);
    printf("This one messes it up!\n");
    printf("%s\n",dir);
    printf("DONE\n");
    return 0;
}
 
     
     
    