They do different things, so comparing them directly does not make sense.
strncmp compares the first
n (or fewer, if the string ends sooner) characters of a string.
strcmp compares whole strings. If
n is sufficiently large that
strncmp will compare the whole strings (so that the behavior becomes effectively the same as
strncmp is likely to be moderately slower because it also has to keep track of a counter, but the difference might or might not be measurable or even present in a given implementation. For example an implementation of
strcmp could just pass
SIZE_MAX as the value for