strcmp c
snippet in c

strcmp c

user9934

// use: strcmp(string1, string2);

string a = "words";
string b = "words";

if (strcmp(a, b) == 0)
{
	printf("a and b match");
  	// strcmp returns 0 if both strings match
}

else
{
	printf("a and b don't match");
  	// strcmp returns anything else if the strings dont match
}

strncmp c

user785

int strncmp(const char *str1, const char *str2, size_t n)
  
//if Return value < 0 then it indicates str1 is less than str2.
//if Return value > 0 then it indicates str2 is less than str1.
//if Return value = 0 then it indicates str1 is equal to str2.

strcmp c library

user3389

#include <string.h>

compare two chars c

user3795

strcmp(char, char);

string compare in c

user4366

strcmp(str1, str2) = 32
strcmp(str1, str3) = 0