Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

strcmp c

// 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
}
Source by man.cs50.io #
 
PREVIOUS NEXT
Tagged: #strcmp
ADD COMMENT
Topic
Name
9+6 =