Horje
c strcmp Code Example
see if two strings are equal in C
#include <stdio.h>
#include <string.h>
int main(int argc, char const *argv[]) {
   char string1[] = {"tutorials point"};
   char string2[] = {"tutorials point"};
   //using function strcmp() to compare the two strings
   if (strcmp(string1, string2) == 0)
      printf("Yes 2 strings are same\n");
   else
      printf("No, 2 strings are not same\n" );
      return 0;
}
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;
}




C

Related
right side of div Code Example right side of div Code Example
Gemfile.lock`. It is likely that you need to grant write permissions for that path. Code Example Gemfile.lock`. It is likely that you need to grant write permissions for that path. Code Example
c zero out array Code Example c zero out array Code Example
how to turn off zsh Code Example how to turn off zsh Code Example
strstr Code Example strstr Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11