第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

C語言strcmp函數(shù)是什么樣的代碼?

C語言strcmp函數(shù)是什么樣的代碼?

C
繁星點點滴滴 2019-02-07 11:07:24
C語言strcmp函數(shù)是什么樣的代碼
查看完整描述

4 回答

?
慕尼黑8549860

TA貢獻1818條經(jīng)驗 獲得超11個贊

strcmp(s1,s2)
相同返回0
當(dāng)s1<s2時,返回值<0 當(dāng)s1=s2時,返回值=0 當(dāng)s1>s2時,返回值>0 即:兩個字符串自左向右逐個字符相比(按ASCII值大小相比較),直到出現(xiàn)不同的字符或遇'\0'為止。如: "A"<"B" "a">"A" "computer">"compare" 特別注意:strcmp(s1,s2)這里面只能比較字符串,不能比較數(shù)字等其他形式的參數(shù)。

查看完整回答
反對 回復(fù) 2019-03-22
?
Helenr

TA貢獻1780條經(jīng)驗 獲得超4個贊

page ,132
title strcmp.asm - compare two strings
;***
;strcmp.asm - routine to compare two strings (for equal, less, or greater)
;
; Copyright (c) Microsoft Corporation. All rights reserved.
;
;Purpose:
; STRCMP compares two strings and returns an integer
; to indicate whether the first is less than the second, the two are
; equal, or whether the first is greater than the second, respectively.
; Comparison is done byte by byte on an UNSIGNED basis, which is to
; say that Null (0) is less than any other character (1-255).
;
;*******************************************************************************

.xlist
include cruntime.inc
.list

page
;***
;strcmp - compare two strings, returning less than, equal to, or greater than
;
;Purpose:
; Compares two string, determining their lexical order. Unsigned
; comparison is used.
;
; Algorithm:
; int strcmp ( src , dst )
; unsigned char *src;
; unsigned char *dst;
; {
; int ret = 0 ;
;
; while( ! (ret = *src - *dst) && *dst)
; ++src, ++dst;
;
; if ( ret < 0 )
; ret = -1 ;
; else if ( ret > 0 )
; ret = 1 ;
;
; return( ret );
; }
;
;Entry:
; const char * src - string for left-hand side of comparison
; const char * dst - string for right-hand side of comparison
;
;Exit:
; AX < 0, 0, or >0, indicating whether the first string is
; Less than, Equal to, or Greater than the second string.
;
;Uses:
; CX, DX
;
;Exceptions:
;
;*******************************************************************************

CODESEG

public strcmp
strcmp proc \
str1:ptr byte, \
str2:ptr byte

OPTION PROLOGUE:NONE, EPILOGUE:NONE

.FPO ( 0, 2, 0, 0, 0, 0 )

mov edx,[esp + 4] ; edx = src
mov ecx,[esp + 8] ; ecx = dst

test edx,3
jnz short dopartial

align 4
dodwords:
mov eax,[edx]

cmp al,[ecx]
jne short donene
or al,al
jz short doneeq
cmp ah,[ecx + 1]
jne short donene
or ah,ah
jz short doneeq

shr eax,16

cmp al,[ecx + 2]
jne short donene
or al,al
jz short doneeq
cmp ah,[ecx + 3]
jne short donene
add ecx,4
add edx,4
or ah,ah
jnz short dodwords

align 4
doneeq:
xor eax,eax
ret

align 4
donene:
; The instructions below should place -1 in eax if src < dst,
; and 1 in eax if src > dst.

sbb eax,eax
sal eax,1
add eax,1
ret

align 4
dopartial:
test edx,1
jz short doword

mov al,[edx]
add edx,1
cmp al,[ecx]
jne short donene
add ecx,1
or al,al
jz short doneeq

test edx,2
jz short dodwords

align 4
doword:
mov ax,[edx]
add edx,2
cmp al,[ecx]
jne short donene
or al,al
jz short doneeq
cmp ah,[ecx + 1]
jne short donene
or ah,ah
jz short doneeq
add ecx,2
jmp short dodwords

strcmp endp



查看完整回答
反對 回復(fù) 2019-03-22
  • 4 回答
  • 0 關(guān)注
  • 1340 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號