<address id="ousso"></address>
<form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
  1. C語言

    c語言strcmp的用法

    時間:2025-02-18 03:08:51 C語言 我要投稿
    • 相關推薦

    c語言strcmp的用法

      函數 int stringcompare(char *source, char *target) 比較字符串 source 和 target,并根據 source 是否小于、等于或大于 target 的結果分別返回負整數、0或者整數。該返回值是 source 和 target 由前后逐字符比較時遇到的第一個不相等字符處的字符的差值。下面小編就來為大家介紹下c語言strcmp的用法。

      #include

      int stringcompare(char *source, char *target);

      int main()

      {

      char str_a[] = "Welcome to www.nowamagic.net";

      char str_b[] = "Welcome to www.nowamagic.net";

      int wait, result;

      result = stringcompare(str_b, str_a);

      printf("After Function Call: ");

      printf("result is '%d' ", result);

      scanf("%d", &wait);

      }

      /* 根據 source 按照字典順序小于、等于或大于 target 的結果分別返回負整數、0或者整數 */

      int stringcompare(char *source, char *target)

      {

      int i;

      for(i = 0; source[i] == target[i]; i++)

      {

      if (source[i] == '

    <address id="ousso"></address>
    <form id="ousso"><track id="ousso"><big id="ousso"></big></track></form>
    1. 日日做夜狠狠爱欧美黑人