I am building a custom shell in c, and one of the requirements is that the folder from while you run the program must be the "home" folder.
That is, if you type in just
basedir = cwd;
void cd_me(char **argv)
char *basedir; basedir = cwd;
basedir a synonym to
basedir follows. It's a pointer, it cannot remember its own string, it can only point to someone else's string.
You must make a copy instead.
char basedir; strcpy(basedir,cwd);
Add bounds checks and error handling as needed.