当前位置:网站首页>Basic C language operators and their priority (1)

Basic C language operators and their priority (1)

2021-01-23 19:03:53 Mu Ge AI programming

One 、 Preface

C One of the main features of language : Operator rich

C Language operators cover a wide range of , share 34 Operator .C Language bracket 、 comma 、 exclamation mark 、 Assignments and casts are treated as operators , So that C The operation type of language and its richness , The expression types are various . Flexible use of operators can achieve operations that are difficult to achieve in other high-level languages .

The basis of C Language operators are something every programmer should learn , It is very necessary for us to know clearly what operators are and what we must master . If there are any mistakes and inadequate analysis in the article , I hope you can give me some advice , Thank you for your support , Common progress !!!

Two 、 Operator definition

An operator is a symbol that tells the compiler to perform a specific mathematical or logical operation . It's a structure C Language expression tools   .C The operation of language is very rich , Almost all basic operations except control statements and input and output are handled by operators . In addition to the three common categories , Arithmetic operator 、 Besides relational operators and logical operators , There are also operators for special tasks , For example, bit operators .

This chapter introduces the arithmetic operators one by one 、 Relational operator 、 Logical operators 、 An operator 、 Assignment operators and other operators .

3、 ... and 、 Operator classification

 

 

【 Be careful 】 From the following angles, we can roughly C Language operators are divided into :13 Class operators or 34 Operator , All in all 44 Operators .

Careful you will find that the above operators are not enough 44 individual , For the first 5 Class operators : The assignment operators are 11 individual . This is described in detail in the operator priority and combination direction table below .

Four 、 Operator precedence

The priority of operators can be divided into 15 level :

1 The first level has the highest priority ,15 The first level has the lowest priority .

Operators of the same priority ( When the priority of operators on both sides of an operation object is the same ), The order of operations is determined by the direction of combination ( associativity ) Determined by , Except for the unary operator 、 The three operators are from right to left , The other operators are from left to right .

Common operators, common notation :

! >  Arithmetic operator  >  Relational operator  > && > || >  Assignment operator

 

 

 

 

 

 

 

Because there's so much knowledge about operators , Today, I'll just show you operators and their priorities , Next time, let's talk about the use of common operators .


 

If you want to improve your programming skills better , Learn from good examples C Language C++ Programming ! Overtaking in curve , One step at a time !

C Language C++ Learn from Penguin circle 】, Share ( Source code 、 Project practice video 、 Project notes , Introduction to Basics )

Welcome to change careers and learn programming partners , Using more information to learn and grow faster than thinking about it yourself !

Programming learning books :


 

Programming learning video :

 

版权声明
本文为[Mu Ge AI programming]所创,转载请带上原文链接,感谢
https://chowdera.com/2021/01/20210123190145708u.html

随机推荐