Exercise 5-4

xiaoxiao2021-03-06  53

/ *

Write a function Strend (S, T). If the string T appears in the tail of the string S, the function returns 1, otherwise returns 0

* /

Int Strend (Char * S, Char * T)

{

While (* s! = '/ 0')

IF (* (s ) == * t) {

T ;

IF (Strlen (T) == Strlen (s))

IF (strcmp (t, s) == 0)

Return 1;

}

Return 0;

}

Int main (void)

{

Char a [1000] = {"dwefjsadjfkwjfwfowfworld"};

Char * b = "world";

IF (Strend (A, B) == 1) Printf ("YES");

Return 0;

}

转载请注明原文地址:https://www.9cbs.com/read-115593.html

New Post(0)