2.3.1 Basic data types and operators

Source: Internet
Author: User

1 in the C language, the operator that requires the operand to be an integral type is %

  2 int i = j = 5;→ This definition method is wrong :Note:each Undeclared identifier is reported only once for each func tion it appears in. /* int i =5, j = 5; */

3 Copy the larger number of integral type, a, to int c:c = (a>b)? a:b;√

4 in the C language, backspace is \b:

  5 int a = 7; float x = 2.5,y = 4.7; The value of the expression x + a% 3 * (int) (x + y)% 2/4 is: 2.50000

6 int x, I, J, K; Then x = (i = 4, j = +, k = 32); The value of X is: 32

1 intMain ()2 {3     intx,j,i,k;4x = (i =4, j = $, k = +);5printf"%d", x);6 return 0;7     8     }9 /*output result is*/

7 int x = 8, y = 3; ask printf ("x = 8,y = 3\n x--:%d,--y:%d\n", x--,--y); What is the output of the result?

 int  x = 8 , y = 3  ; printf (  x = 8,y = 3\n x--:%d,--y:%d\n     , x--,--y);  int  a = 8 , B = 3  ; printf (  a = 8,b = 3\n a++:%d,++b:%d\n  , A++,++b);  /*   result: x = 8,y = 3 X--:8,--y:2a = 8,b = 3 A++:8,++b:4  */ 

8 is provided with an int a = 1,b = 2,c = 3, d = 4, m = 2,n = 2; then execute the statement (M = a > B) && (n = c > D); the value after N:

int 1 2 3 4 2 2 ;    = a > B) && (n = c > d);   printf ("%d"/* results are 2* /

9 known int a = 6; , A + = a-= A*a is executed; After, the value of a is:

    int 6 ;     + = A-=A * A;    printf ("A has the value:%d\n"  , a); /* */

Ten int x = 1,y = 1, z = 1; Execute Statement ++x | | + + y && ++z; After, find the value of the expression x + Y: 3

intx =1, y =1, z =1; intk = ++x | | ++y && + +Z; printf ("k = ++x | | ++y && ++z, k =%d\n", K); printf ("x =%d\n", x); printf ("y =%d\n", y); printf ("x+y =%d\n", x+y); intj = ++y && + +Z; printf ("j = ++y && ++z, j =%d\n", J); printf ("x =%d\n", x); printf ("y =%d\n", y); printf ("x+y =%d\n", x+y);/*k = ++x | | ++y && ++z, k = 1x = 2y = 1x+y = 3 J = ++y && ++z, j = 1x = 2y = 2x+y = 4*/    

2.3.1 Basic data types and operators

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.