What does equal to equal mean in c language

下次还敢
Release: 2024-05-02 15:51:15
Original
536 people have browsed it

The equality operator (==) in C language is used to compare whether the values ​​of two expressions are equal, and returns 1 (true) for equality and 0 (false) for inequality.

What does equal to equal mean in c language

Equal to equal operator (==) in C language

In C language, equal to equal to operator (==) is a Boolean operator used to compare the values ​​of two expressions for equality. It returns a boolean value that is true (1) if the expressions are equal, false (0) otherwise.

Grammar

<code class="c">expression1 == expression2</code>
Copy after login

Among them:

  • expression1 and expression2 are to be compared expression.

Return value

  • If expression1 and expression2 are equal, return 1 (true) .
  • Returns 0 (false) if expression1 and expression2 are not equal.

Example

<code class="c">int a = 5;
int b = 5;

if (a == b) {
  printf("a 和 b 相等\n");
} else {
  printf("a 和 b 不相等\n");
}</code>
Copy after login

Output:

<code>a 和 b 相等</code>
Copy after login

Because the values ​​of a and b are both 5, so a == b is true.

The above is the detailed content of What does equal to equal mean in c language. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!