Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of C++ operator

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article introduces you the example analysis of C++ operator, the content is very detailed, interested friends can refer to, hope to be helpful to you.

C++ operator is an advanced C++ technology in C++, the following introduction, you may find that some operators use the same symbols, the meaning of symbols can change with the environment, you can learn through the program and code to understand its important issues.

There are many operators in C++. I don't want to list them all here, but only the most commonly used operators, as shown in the following table. Examples of commonly used C++ operators:

The arithmetical operator + plus x quoz;-minus x quoz; * multiplicates x quoz; / divides x quoz; assignment operator = assignment x times 10; + = assignment and and x times 10; (equal to xx=x+10;)-= assignment and subtraction x words 10; * = assignment and division x\ = 10; & = assignment bits and x parts 0x02; | = assignment bits or x | = 0x02 Logic operator & & Logic and if (x & & 0xFF) {...} | Logic or if (x | | 0xFF) {...} equation operator = = equal to if (x = = 10) {...}! = not equal to if (x! = 10) {...}

< 小于 if(x < 10) {...} >

Greater than if (x > 10) {...} = 10) {...} unary operator * indirect operator int x operators; & address operator int* x operators; ~ bit non-x & = ~ 0x02;! Logical non-if (! valid) {...} + increment operator Xray + (equal to xx=x+1;)-- decrement operator XMurray; class and structure operators:: range resolution MyClass:: SomeFunction ();-> indirect member MyClass- > SomeFunction (); direct member MyClass. SomeFunction ()

As you can see, this list is too long to remember at once. You will gradually become familiar with these operators when using C++. It is important to note that the increment C++ operator can be used either as a pre-increment (+ + x) or as a post-increment (x increment +). The pre-increment operator tells the compiler to increment before using the variable, and then the increment C++ operator tells the compiler to use the value of the variable before incrementing. For example, the following code:

Int x = 10; cout

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report