answersLogoWhite

0


Best Answer

Registers used: ax,ds,si,di,cl

flags affected: zf,cf

program:

assume cs:code,ds:data

code segment

mov ax,data

mov ds,ax

mov si,offset str1

mov di,offset str2

mov cl,count

cld

rep cmpsb

hlt

code ends

data segment

str1 db 04h,05h,07h,08h

count equ 04h

org 0010h

str2 db 04h,06h,07h,09h

data ends

end

result:

input: str1 (ds:0000h) = 04h,05h,07h,08h

str2 (ds:0010h) = 04h,06h,07h,09h

User Avatar

Wiki User

11y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

There are two different types of equality for Strings - object equality (==) and comparative (compareTo(), equals()). Object equality compares the memory addresses of two Strings, which is probably not what you are looking for. To test for equality, you can use String's equals() method.

Example: "abc".equals("abc"); //true

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

#include <stdio.h> #include <string.h> int main() { char *str1 = "sample", *str2 = "sample"; if(strcmp(str1,str2)==0) printf("strings are equal"); retrun 0; }

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

in java, two strings can be compared .but not by using the pointers because there is no existence of pointeres in java.

This answer is:
User Avatar

User Avatar

Wiki User

11y ago

pagalo hamian khud nahi ata:p

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program to compare two strings?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering
Related questions

Write a c program to copy two strings using pointers?

nahi malum


Write a script that accepts two strings from the user and compare two strings in web technology?

how to compare two strings that take input from the user and compare it. For example: i give first string as "THE" and give second string as "HTE" then return "match" if i give first as"THE" nd second string as "EHI" then return "NOtMatch" witout using STRCMP ... please help me


Write a program to compare two strings with out using strcmp function?

#include main() { //please read two strings int str1 and str2// while(str1[i]!='/0' &amp;&amp;str2[i]!='/0') if(str1[i]!=str2[i]) flag=1; if(flag==1) printf("equal"); } #include main() { //please read two strings int str1 and str2// while(str1[i]!='/0' &amp;&amp;str2[i]!='/0') if(str1[i]!=str2[i]) flag=1; if(flag==1) printf("equal"); }


'c' code to compare two strings using strcmp function?

char one [] = "A string" ;char two [] = "Different String" ;if (strcmp (one, two) == 0){puts ("The two strings are identical") ;}else{puts ("The two strings are different") ;}


A Write the algorithm to concatenate two given strings?

a write the algorithm to concatenate two given string


What is the Program for compare two strings using OR operator in java?

The String class includes two helpful methods: equals and compareTo.string1.equals(string2) will return true if the two strings contain the exact same charactersstring1.compareTo(string2) will return an int which describes the lexicographic relationship between the two strings. It will return a negative value if string1 is "less than" string2, a positive value if string1 is "greater than" string2, or zero if the two are equivalent strings.


What is the C plus plus program for string compare?

You don't need a program to compare strings since std::string already provides support for all the comparison operators (&lt;, &lt;=, &gt;, &gt;=, == and !=). To roll your own you must first create a string class and then provide operator overloads for the comparison operators. To compare strings, start at the first character in each string and compare. So long as they remain equal, move onto the next character. The comparison ends as soon as any character differs. You need only compare these two characters to decide which string is the lesser. To perform a case insensitive comparison, copy the two characters and convert the copies to lower case (or upper case, it doesn't matter). Then compare the copies. Do this for each character as you compare them rather than converting the entire string.


Write a program in c that prompt user with following lines add two integers test an integer for odd or even and quit?

write a program in C that prompts the user with the following lines: a) Add two integers c) Compare two integers for the larger t) Test an integers for odd or even q) Quit


How to write aC program to merge two singly linked list?

write a c program to circular queue


For curiously write the form you would use to compare two things?

what is the form you would use the word curiously to compare two things


Write a regular expression for binary strings with at least two 0s but not consecutive 0s.?

1*01+01*


Can you tell me a C program to find if the strings are equal using pointers?

It is called strcmp, part of the standard run-time library. Returns 0 if the two strings are equals, non-zero otherwise.