LuvSea

strcmp 구현 본문

sTudy

strcmp 구현

사랑海 2009. 7. 10. 10:39
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

// 문자열의 대소 비교
int
 strcmp2(char *s1, char *s2)
{
  while(*s1 == *s2 && *s1 != '\0' && *s2 != '\0')
  {
    s1++;
    s2++;
  }
  if(*s1 < *s2)    return(-1);
  else if(*s1 > *s2)  return(1);
  else return(0);
}

'sTudy' 카테고리의 다른 글

strupr 구현  (0) 2009.07.10
strrev 구현  (0) 2009.07.10
strlen 구현  (0) 2009.07.10
strcat 구현  (0) 2009.07.10
strcpy 구현  (0) 2009.07.10
Comments