Basic course of C language (ii) data types, variables, and operators (19)

Source: Internet
Author: User
Four, sizeof operator
The sizeof operator is a single eye operator that returns the byte length of a variable or type.
For example:
sizeof (double) is 8
sizeof (int) is 2
You can also ask for a defined variable, such as:
float F;
int i;
I=sizeof (f);
The value of I will be 4.
V. Joint operations
Turbo C has a special shorthand for simplifying an assignment statement for all the binocular operators. Its general form is:
< variables >=< variables >< operands >< expression >
Equivalent
< variables >< operands >=< expression >
For example:
A=a+b can be written a+=b
A=a&b can be written a&=b
a=a/(B-C) can be written in a/=b-c
Priority of the 5.5 Turbo C operator
Turbo C prescribes the precedence of operators. When more than one operator in an expression participates in an operation, the precedence specified in the following table is performed. The precedence of the table is lowered from top down and the same row priority is the same.
For example:
Expression 10>4&&! (100<99) | | The value of 3<=5 is 1
Expression 10>4&&! (100<99) The value of &&3<=5 is 0
Priority of the Turbo C operator
━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━
Expression ┃ Precedence
────────────────────────────╂────
() (parentheses) [] (array subscript). (struct member)-> (member of pointer structure) ┃ highest
────────────────────────────┃↑
! (Logically not). (Bit counter)-(minus) + + (plus 1)--(minus 1) & (variable address) ┃│
────────────────────────────┃│
* (what the pointer refers to) type (function description) sizeof (length calculation) ┃│
────────────────────────────┃│
* (multiply)/(except)% (modulo) ┃│
────────────────────────────┃│
+ (plus)-(minus) ┃│
────────────────────────────┃│
<< (bit left) >> (bit right shift) ┃│
────────────────────────────┃│
< (less than) <= (less than or equal) > (greater than) >= (greater than or equal) ┃│
────────────────────────────┃│
= = = (equal to)!= (not equal to) ┃│
────────────────────────────┃│
& (Bit and) ┃│
────────────────────────────┃│
^ (bit xor or) ┃│
────────────────────────────┃│
| (bit or) ┃│
────────────────────────────┃│
&& (logic and) ┃│
────────────────────────────┃│
|| (Logical OR) ┃│
────────────────────────────┃│
?:(? expression) ┃│
────────────────────────────┃│
= + = = (Federated operation) ┃│
────────────────────────────┃│
, (comma operator) ┃ lowest
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.