# strcmp

### Function

> strcmp

### Syntax

> strcmp( Str1, Str2 );

### Parameters

**\[Str1]**

A [MASM-like expression](https://docs.hyperdbg.org/commands/scripting-language/assumptions-and-evaluations) or a string to compare with **Str2**.

**\[Str2]**

A [MASM-like expression](https://docs.hyperdbg.org/commands/scripting-language/assumptions-and-evaluations) or a string to compare with **Str1**.

### Description

Compares the string ***Str1*** to the string ***Str2***.

### Return value

Returns an integer value indicating the relationship between the strings:<br>

| Return Value | Indicates                                                                                     |
| ------------ | --------------------------------------------------------------------------------------------- |
| <0           | The first character that does not match has a lower value in ***Str1*** than in ***Str2**.*   |
| 0            | The contents of both strings are equal.                                                       |
| >0           | The first character that does not match has a greater value in ***Str1*** than in ***Str2**.* |

### Examples

``strcmp(fffff806`6de00000, @rax+c0);``

Compare the string located at ``fffff806`6de00000`` with the string located at `@rax+c0`.

`strcmp(@rcx, "Test String");`

Compare the string located at `@rcx` with the string `"Test String"`.

`strcmp("Test String1", "Test String2");`

Compare the string `"Test String1"` with the string `"Test String2"`.

### Remarks

This function checks for the validity of both the source and the destination address before the comparison.&#x20;

The support for this function is added from **v0.7**.

### Related

[strncmp](https://docs.hyperdbg.org/commands/scripting-language/functions/strings/strncmp)

[wcscmp](https://docs.hyperdbg.org/commands/scripting-language/functions/strings/wcscmp)

[wcsncmp](https://docs.hyperdbg.org/commands/scripting-language/functions/strings/wcsncmp)

[memcmp](https://docs.hyperdbg.org/commands/scripting-language/functions/memory/memcmp)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hyperdbg.org/commands/scripting-language/functions/strings/strcmp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
