C language look at the program problem, C language read program problem?

Updated on technology 2024-04-08
7 answers
  1. Anonymous users2024-02-07

    In the C language. An integer constant starting with 0 refers to octal. 027 is 2x8+7, so the answer is c.

  2. Anonymous users2024-02-06

    Question 5, m=027 where 0 represents octal, and the output is changed to decimal, i.e. 2 8+7=23.

    Sixth, since the statement belongs to the logical judgment that the result is only 0 or 1, and because the values that are not 0 are all true, that is, 1. So it can be seen as 1&&1 1=1

    Question 7, x+=x%=(6)+4 can be regarded as:

    x%=-2,x+=x

    According to the above order, the first x = 10% (-2) = 0 This is x changed from 10 to 0, so the second x is equivalent to x = 0 + 0 = 0 Read more books by yourself, and it is not difficult to think more.

  3. Anonymous users2024-02-05

    First of all, you need to know a few things:

    1. printf("%d",--x) and printf("%d", x--)

    The former calculates x=x-1 and then outputs x, while the latter outputs x=x-1 and then calculates x=x-1

    2.The role of continue:

    continue is to end the loop and skip the unexecuted statement below the loop body.

    In this case, you are skipping printf("%d,",--x);This line goes back to for(;; x>0 ;x--) line.

    3.if(0) and if(non-zero):

    A value of 0 is false, and a value that is not zero is true. Therefore, the statement in if(0) is not executed, and the statement in if(non-zero) is executed.

    process (each step is every time to determine whether x>0 is true or not):

    1.At this time, x=8, because x%3=non-zero, so the output x value is 8, and then x=x-1 is calculated, and continue returns to for(; x>0;x--) This line calculates x--

    2.In this case, x=6, because x%3=0, printf( is executed"%d,",--x);This line calculates x=x-1 and outputs the x value of 5

    Finally back to for(; x>0;x--) This line calculates x--

    3.In this case, x=4, because x%3=non-zero, so the output x value is 4, and then x=x-1 is calculated, and continue returns to for(; x>0;x--) This line calculates x--

    4.At this time, x=2, because x%3=non-zero, so the output x value 2, and then calculate x=x-1, continue back to for(; x>0;x--) This line calculates x--

    5.At this time, x=0, at this time, x>0 is no longer established, and the program is over.

  4. Anonymous users2024-02-04

    x=8 x>0 8%3 is 2 if is true [output x-- is 8 ] x is 7 after executing continue x-- x is 6

    x=6 x>0 6%3 is 0 if is not true [output --x is 5] x is 5 execute x-- x is 4

    x=4 x>0 Hold 4%3 is 1 If Hold [Output x--is 4] x is 3 Execute x-- x is 2

    x=2 x>0 Hold 2%3 Hold 2 If Hold [Output x--2]x is 1 Execute x-- x is 0

    x=0 x>0 does not hold ends.

    So the output is 8 5 4 2

  5. Anonymous users2024-02-03

    First x = 8

    for loop.

    First time x = 8

    x%3 = 2 if statement is true.

    Enter x-- output 8 first, then x-- x=7, second x-- after x= 6

    x%3 = 0 if statement is not true.

    Execute the output statement --x x=5 and then output 5

    After the third x--after x= 4

    x%3 = 1 if statement is true.

    Output 4 first and then x-- x=3

    After the fourth x-x=2

    The 2%3 = 2 if statement is true.

    Output 2 first and then x-- x=1

    After the fifth x-- x = 0

    x>0 does not hold to exit the loop.

    End of program.

  6. Anonymous users2024-02-02

    The first time x=8, x%3=2 is true, and the expression is 8 after x--, 8 is printed, but x becomes 7, and the following printf does not need to be executed.

    to the for loop x--, which becomes 6 x%3=0 is false Execute printf("%d,",x); The expression for x is 5

    After going to the for loop x--, it becomes 4 4% 3=1 is true Execute the if statement Print printf("%d,", x--) is 4 and x is 3

    to the for loop x--, which becomes 2 2% 3=2 is true Execute the if statement Print printf("%d,", x--) is 2 and x is 1

    After the for loop x---, x=0 does not meet the condition and jumps out.

  7. Anonymous users2024-02-01

    Determine whether x>0 is true, and terminate the function if x>0 is not true. If x>0 is true, then determine whether x%3 is 1, if so, execute x--x-in the for statement--if x%3 is not 1, execute printf("%d,",x);

Related questions
5 answers2024-04-08

Question 1: pt1=&a;pt2=&b;pt1 and pt2 are not defined, years are defined as. >>>More

7 answers2024-04-08

In the whole main function, only this one variable, whether it is the first for or the second for, is the same i, the second for will have i=-1, in the case of i= -1, and printf("%d ",a[i]);Statement. So fear not! When there is no second for the case: >>>More

7 answers2024-04-08

char *p;

uchar log_type; >>>More

9 answers2024-04-08

After testing, ** runs OK, and only 1 place is modified.

#include >>>More

19 answers2024-04-08

C language in computer software (Windows platform) programming.