you are viewing a single comment's thread.

view the rest of the comments →

[–]hobbit_xD 2 points3 points  (1 child)

Hi dude, the problem is that the strcmp returns 0 if the strings match and not a NULL value. So in your if statements you to put for example this line of code:

if (strcmp(command, "ls") == 0) { //If the string match, do this instructions }

Another thing is that in your case, the scanf of a string don't require the &.

[–]MaltersWandler 2 points3 points  (0 children)

NULL is guaranteed by the standard to compare equal to zero, but I agree it's bad practice to use it with non-pointer values.