strchr c code example

Example 1: strncmp c

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.

Example 2: strncpy c

char *strncpy(char *dest, const char *src, size_t n)

Example 3: strdup c

// use : char *strdup(char *str)

string1 = "hello"
string2 = strdup(string1)"

printf("%s", string2)

// print : hello

Tags:

C Example