Home > Back-end >  A and a problems in the C language, bosses explanation, thank you.
A and a problems in the C language, bosses explanation, thank you.

Time:12-04

Int a, b, c, d, e;
A=2;
B=+;
C=+ + a;
D=10 x +;
E=10 x + + a;

Ask, bcde respectively is what, is,,,

CodePudding user response:

B=3
C=4
D=50
E=60

CodePudding user response:

reference 1st floor yzy982130864 response:

b=3C=4
D=50
E=60

Just so simple,,,,

CodePudding user response:

+ is to calculate a first, and then calculate a + 1, b=+, is to assign a, b and then calculate a=a + 1, b=2 so, but a is 3, + + a is to calculate a + 1, and worked out the result in the assigned values, such as=c + + a here, in front of a is 3, then work out a + 1, is c=4, then a is 4, d, e, I am so understand

CodePudding user response:

+ + said after the first ascribed value again since, while the first + + said since the first assignment again, so
B=2
C=4
D=40
E=60

CodePudding user response:

reference 1st floor yzy982130864 response:

b=3C=4
D=50
E=60
error

CodePudding user response:

The basis of algorithm and the meaning of + + priority

CodePudding user response:

Write a program to test? Programming need more hands-on, think more ~

CodePudding user response:

Try to avoid these meaningless things

CodePudding user response:

About C, C + + expression evaluation sequence, http://blog.csdn.net/fefe82/article/details/37833767, http://bbs.csdn.net/topics/370153775

CodePudding user response:

2
4
40
60

CodePudding user response:

Can run programming, don't ask,

CodePudding user response:

The building Lord not knot ? (to use a computer ")
Question is not clear, then I'll have more a few words of mouth:
+ and + + a are two of a on the

But:
+ expression of a (the original a value), + + a expression from the value of the increased after a

For example, int a=5
B=+ + a;
C=+;

If the output, since increased twice, a reason for 7, 6 b, c for 6,
(if there is an error, please correct me,)

CodePudding user response:

Int a, b, c, d, e;
A=2;
B=+;//2 + + +==3, b=a=3
C=+ + a;
D=10 x +;
E=10 x + + a;

CodePudding user response:

 int a, b, c, d, e; 
A=2;
B=+;//=a=2 b, a=2 + + +==3,
C=+ + a;//a=+ + + + 3=a=4, c=4
D=10 x +;//10 * 10 * 4=a=40, 40, d=a==+ + + 4=5
E=10 x + + a;//a=+ + + + 5=a=6, e=10 * 10 * 6=a=60


So a=6,
B=2,
C=4,
E=60,

The above reply, I still haven't finished the input submitted... Just look at this article

CodePudding user response:




VS2017 running result is shown in figure, in the process you can see me in a reply on the comments,
I'm to integral, should take the time to write this...
Learn more programming to write code around, there is a problem of place can set breakpoints, step through to see how the values of these variables changes, naturally understand.
So... Would you please give me some points...

CodePudding user response:

On the 14th floor seven
reference jing 'an response:
 int a, b, c, d, e; 
A=2;
B=+;//=a=2 b, a=2 + + +==3,
C=+ + a;//a=+ + + + 3=a=4, c=4
D=10 x +;//10 * 10 * 4=a=40, 40, d=a==+ + + 4=5
E=10 x + + a;//a=+ + + + 5=a=6, e=10 * 10 * 6=a=60


So a=6,
B=2,
C=4,
E=60,

The above reply, I still haven't finished the input submitted... Just look at this article


I have a little problem: the operator + + is not higher than the priority *
Why is 40 d rather than 50

CodePudding user response:

reference 16 floors and two yellow reply:
Quote: refer to the 14 floor seven jing 'an reply:

 int a, b, c, d, e; 
A=2;
B=+;//=a=2 b, a=2 + + +==3,
C=+ + a;//a=+ + + + 3=a=4, c=4
D=10 x +;//10 * 10 * 4=a=40, 40, d=a==+ + + 4=5
E=10 x + + a;//a=+ + + + 5=a=6, e=10 * 10 * 6=a=60


So a=6,
B=2,
C=4,
E=60,

The above reply, I still haven't finished the input submitted... Just look at this article


I have a little problem: the operator + + is not higher than the priority *
Why is 40 d rather than 50

You said that the priority of right, but the rear + +, the statement of operand evaluation results, is not the a + 1,
That is to say, when running this statement, not with a + 1 when the value of the operation, operation results, and then to + 1 a,

If there is a + + a, run the statement, is first to + 1 a, then use the + 1 after a operation, operation results, so at this time is 50 d,

CodePudding user response:

+ + a + 1 first, then use a value, + is with a value of the first, and + 1

CodePudding user response:

B=2
C=4
D=40
E=60

CodePudding user response:

B=2
C=4
D=40
E=60
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull