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 :: convert int to string c 
C :: print short in c 
C :: c print to stderr 
C :: read a document in c getting name from console 
C :: 2 bytes integer c 
C :: c style string 
C :: arduino wifi client 
C :: multiplication table in c 
C :: convert int to char in c 
C :: add_to_cart how to call it woocommerce 
C :: bitwise and in c 
C :: write a c program to find size of variable 
C :: bash get load average 
C :: c for 
C :: program to find the average of n numbers using arrays. 
C :: second largest element in an array 
C :: mongodb read 
C :: C strlen implementation 
C :: C program to input the month number and output the month name using switch statement 
C :: pointer arithmetic on Arrray in c 
C :: stddef.h 
C :: enum case statement in c 
C :: passing pointer to function 
C :: unused variable in c 
C :: predefined macros 
C :: 4 byte alignment c code 
C :: dev c online 
C :: C #if, #elif and #else Directive 
C :: OpenDaylight maven settings 
C :: kleiner gleich zeichen MAC 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =