I am learning about side-effects and pure functions. I know that pure functions have no side-effects and their return value is the same for the same arguments. I would like to know whether the C function strcmp()
is a pure function. I believe that it is pure, due to the fact that given the same two strings as parameters, the result will always be the same. Furthermore, strcmp()
does not modify any variables or call any functions, thus it does not have any side effects.
However I am not sure whether my reasoning is correct.