C If int i 3 is defined, what is the value of a after i i is executed?

Updated on technology 2024-06-11
13 answers
  1. Anonymous users2024-02-11

    Answer: Since - and - are both right-combined, they both act on the preceding i. In this way, it is possible to understand i---i expression as (i-)-i and (i--)i; But the C compiler has a rule called "greed" that states that "as many symbols as possible" are to be interpreted "all at once", so i---i is interpreted as (i--)i and not as (i-)-i.

    In this case, because i-- is the posterior --,a=i---i; is interpreted as a=i-i; i=i-1;, the result is a=3-3=0, i=3-1=2. However, this question is a bit special, interpreting i---i as (i-)-i, and the result is also 0; Because --i becomes the first --, to be calculated first, a=i---i; is interpreted as i=i-1; a=i-i;, the result is a=2-2=0 - this is a "redundant" word, for reference.

  2. Anonymous users2024-02-10

    The behavior is not defined, the standard does not guarantee what the result of such an expression will be, and the compiler can do anything at its discretion. In other words, any value that your compiler comes up with, or a compilation error, is in line with the language standards.

    Therefore such a ** is wrong, avoid writing such a **.

    When a variable appears multiple times in the same expression, avoid using the incrementing and decrementing operator for it.

  3. Anonymous users2024-02-09

    with the statement int a; then execute statement a 4*5,a+5;The value after a is the precedence of the 20 comma expression.

    It has a lower priority than the assignment operation, so it does a=4*5 (the value of a becomes 20) and then calculates a+5.

    The value of the entire comma expression is 25, and the value of variable a is 20.

  4. Anonymous users2024-02-08

    4*5 is the expression; The value is assigned to a, so the value of a is 20; a+5;is an expression, which is not assigned to any variable; So the value of a is still 20.

    The int type occupies 4 bytes in memory, which is 32 bits. The int type is signed, so the 32 bits are not all used to store the data, the highest bit is used to store the symbol, the highest bit is 0, the hint data is positive, the highest bit is 1, which means the data is negative, and the other 31 bits are used to store the data.

  5. Anonymous users2024-02-07

    a=4x5=20, then a1=a0+5=25

    After the cycle, a has a value of 25

  6. Anonymous users2024-02-06

    The answer should be B

    a=10, a+10, a++ is a comma expression, the rule of the comma expression is what the first expression is calculated from the first expression until the last expression is calculated, and the value of the last expression is the value of the comma expression.

    According to this rule, a = 10 is calculated first, the value is equal to 10, and the variable a is also assigned a value of 10. Calculate a+10 and the value is 20Finally, the value of A++ is calculated to be 10, and the value of A is 11But the value of the whole expression is 10, so choose b.

  7. Anonymous users2024-02-05

    The whole expression is equivalent to (a=10), a+10, a++, is a comma expression, the value is 10, and a is finally equal to 11.

  8. Anonymous users2024-02-04

    The answer is 11, and this is the number of words.

  9. Anonymous users2024-02-03

    30。This is the priority of the operator in the C language, first execute the parenthetical program, then execute the comma operator, first execute a=2*3, then execute a*5, take the right operand, and then assign the value to i, which is 30.

    **As follows: include

    int main(){

    int i,a;

    printf("The value of the output i is:")

    i =(a=2*3,a*5),a+6;

    printf("%d",i);

    return 0;

    Program Running Result:

  10. Anonymous users2024-02-02

    i=(a=2*3,a*5),a+6

    This is a comma expression.

    The result is the result of the expression after the last comma, i.e., a+6. However, there is no value for this expression to make hail here.

    i=(a=2*3,a*5),a+6;A semicolon can be added to the end of any expression to form an expression statement.

    After this statement is executed, the value of variable i is 30, and the value of variable a is 6.

  11. Anonymous users2024-02-01

    If int+i[5]=, then what is the value of i[2]?

    Hello, is that the title there? Can I take pictures?

    The third. This defines an integer array of length 5.

    Thank you. You are welcome.

    From ii[1] i[2] respectively 1, 2, 3, the last two are empty.

    So pick 3

  12. Anonymous users2024-01-31

    c has a definition: int+a=; then what is the value of the expression a[a[a]].

    Hello, I'm glad to answer for you, C has a definition: int+a=; Then the value of the expression a[a[a]] is what is defined in the c language, inta=6, then the table book is equal to -60 with the expression a+=a-=a*a++. Calculation process:

    From right to left a-=a*a++a++ takes the original value in the previous operation, and adds one after the operation, and the current operation refers to a-=a*a++; So a=a-(a*a++) is a=6-(6*6); If the opening of the upper pose is b, that is, (b = a-(a*a++), then after the end a = 7; b=-30;So now a = 30; Then calculate a+=b on the left; Note: (b = a - (a*a++) because a = 30, b = 30, so the final a = 60

  13. Anonymous users2024-01-30

    In this statement, ++a means to perform an auto-increment operation on variable a, first adding 1 to the value of a, and then assigning the value to c. Therefore, the value of c is the value of a plus 1, that is, 6

Related questions
5 answers2024-06-11

These are not macro definitions, these are file containments. >>>More

6 answers2024-06-11

#include

void sort(int arr,int n); >>>More

4 answers2024-06-11

I've seen questions like this, and I don't understand what you mean, but I think it's like this, structab; I hit ... where you can add definitions of all data forms, e.g., int >>>More

25 answers2024-06-11

Do you mean to say that a is a value of 10 or does a literally mean 10? >>>More

10 answers2024-06-11

Here's a C implementation that assigns an array a[10] to p[n]: >>>More