I get a warning
warning: comparison between pointer and integer
on the line containing if from the next piece of code:
if
Modify line with this one if (getcwd(cwd, sizeof(cwd)) != NULL)
if (getcwd(cwd, sizeof(cwd)) != NULL)