-
The result of running on vc++2005 is 002222
This kind of thing will get different values in different systems, garbage questions, don't bother.
Let me also ask the question: why did the 002222 results occur?
Attached is a description of the self-increasing and self-decreasing operation in the textbook:
And -- are operators with ***, and the reader is advised not to use such an operator for the same variable multiple times in an expression, otherwise unexpected results may occur. For example, the value of i is 4, for the expression.
i++)i++)
It may be thought that it has a value of 9 (4+5). However, in the Turboc and MSC systems, it has a value of 8. And expressions.
i)+(i)
has a value of 12. This is because when these systems process i++, they actually use the original value of i to compute the entire expression, and then let i self-increment twice in a row; When processing ++i, perform two autoincrements on i before the expression ,...... is calculated
Similarly, in a function call, the order in which multiple argument expressions are evaluated will produce different results depending on the left-to-right and right-to-left. For example, if you set the value of i to 4, you can call a function.
printf("%d %d",i,i++)
If the evaluation order of the parameter table is from left to right, the output is used.
Otherwise, it will output:
Since + and ++ are two different operators, there will be different understandings of similar expressions i+++j: ......
Personally, I don't think there is any point in this kind of topic. The landlord has put so much effort into this issue, saying that it is garbage and may have hurt the feelings of the owner, and I apologize here.
However, I still think that's the case, it's a real garbage question, and it's perfect for a middle school competition.
-
Answer: 100210
I would have beaten you a lot, but I'm afraid you'll be confused.
On different programming platforms, there will be different results.
Just a few words, the pre + back + priority is different.
In C++ if it's all i++.
cout and print from back to front.
-
I think it should be.
**The arithmetic sub-leisure level is the highest, and the calculation is carried out first.
-
<> values of a and b remain unchanged after execution.
Since x and y are the address values of a and b respectively, x and y are passed into the fun function as input parameters, so that a=x and b=y in fun, and then the values of a and b are exchanged. But it doesn't change the values of x and y, so it doesn't change the values of a and b in the main function.
-
Hello, glad for your question.
This topic is a typical example of the distinction between numbers and addresses as formal arguments.
In the problem, the addresses of a,b are assigned to x,y, and then x,y is used as arguments to pass to the called function fun, and the form arguments are a,b. Then what is running in the called function is to swap the values of the pointer variables a,b, because the exchange is the address, so in fact, it is to exchange the values of the real arguments x,y, so that x points to b at this time, and y points to a at this time, but it should be noted that the a,b itself in the main function has not changed, so the values of a,b remain unchanged.
-
When the operator overloaded function is of the form c operator++(c c1,int):
1. If it is operator++(c2,5);
When calling, the value is passed, so the value of c2 will not change. Output 5+10i.
2. If it is c2=operator++(c2,5);
The new value of c2 is equal to the value of c0, and the value of c0 is equal to the original value of c2, so the value of c2 remains unchanged. Output 5+10i.
When the operator overloaded function is of the form c operator++(c c1,int):
1. If it is operator++(c2,5);
When it is called, it is addressed, so the value of c2 will change. execute c0=c1+c2++; , the value of C2 is (4+11i), call Operator++(C2,5); , the value of C2 is (3+12i). So; Output 3+12i.
2. If it is c2=operator++(c2,5);
execute c0=c1+c2++; , the value of C2 is (4+11i), call Operator++(C2,5); , the new value of C2 is equal to the value of C0, and the value of C0 is equal to the original value of C2, so the value of C2 remains unchanged. Output 4+11i.
-
It is to output 10 in decimal format in %4d, 10 in octal format, and 10 in hexadecimal format
4d, occupy 4 lines, the left of the insufficient is replaced by a space, 10 accounts for two places, the octal number of 10 in the left two spaces is 12, and the decimal number of 10 is a
Therefore, the output is 10, 12, and a is selected d
-
*p points to the address of aa[0][0].
The addresses of two-dimensional arrays in memory space are continuous.
aa[0][0] aa[0][1] aa[0][2] aa[1][0].aa[2][2].
i=0 aa[0][1]=*p+1
p is aa[0][0].
So aa[0][1]=2+1=3
The output *p is the output aa[0][0].
When followed by i=1.
pp is an address ++p denotes the address at (p+1), and for this problem, *p points to aa[0][1].
So the output *p is the output aa[0][1] and choose a
-
First of all, the content of aa is actually that the } loop is executed only twice: when i==0, aa[0][1]=*p+1===aa[0][0]+1==2+1==3 is executed.
So when i==0, the first row 2,0,0 becomes 2,3,0. The output *p is the output aa[0][0] (since p is of the int * type, *p is also aa[0]), and its value is executed when ++p; If p points to aa[0][1], the output is 3. Since there are no spaces and other symbols before and after %d in printf, the output of 23 is displayed right next to it, so a is correct.
-
The final output of the chain mining is: 9 8 15
That is: i is 9, x is 8, and y is 15.
Here's how it works:
1. do-while first loop:
i i from Zen plus 1 i for 1
if (i%2) condition is true x+=i x+i is assigned to x x as 1
i++ i adds 1 i to 2
y+=i++ In this case, note that i++ refers to the i value for operation first, and then adds 1; ++i is to add 1 first and then reference the i value for calculation. Therefore, y+i is assigned as y, and then i adds 1 y to 2, and i is 3
2. i<=7 is true do-while second loop:
i i plus 1 i is 4
if (i%2) condition is false.
i++ i adds 1 i to 5
y+=i++ y+i is assigned as y, and then i adds 1 y to 7, i is 63, and i<=7 is true do-while third cycle:
i i plus 1 i is 7
if (i%2) condition is true x+=i x+i is assigned to x x as 8
i++ i plus 1 i is 8
y+=i++ y+i is assigned as y, and then i adds 1 y to 15, i is 94, and i<=7 is false. The end of the do-while loop.
5. Print i, x, y i is 9, x is 8, y is 15** running result.
-
Answer: -2x=- m++, the order of operations is.
x=-m then m++
So x = -3, then m++ 4;
x= x+8/++n
n, +1 first, then used, is n = 5, 8 5 = 1x= x+1 =-3+1 = 2
-
x = m++;
In fact, it is x = m
m++ is assigned first and then 1 is added
At this point x =-3;
x = x + 8 /+n
n is the first addition to 5
x = x+8/5 = 2
The final result is -2
-
The answer is 2 0 0,.
At the beginning, s t w is 0;
c=3 is greater than 0, so s=a+b=2;
a=-1<=0 is valid, b=3>0 is valid, but c=3<=0 is not valid, so w=a-b is not executed;
Since if(a<=0) is already true, else if(c>0) w=a-b and else t=c are not executed;
So s is 2 and both t and w are 0
-
Then I'll give you a breakdown.
First if(c>0) holds, so s=2
if(a<0) is established, b>0 is also established, c<=0 is not established, so the rest are not processed.
The output is 2 0 0
int main()
int i,j,a[100]; >>>More
The C language program written according to the requirements of the topic is as follows. >>>More
Cite month[12][10]; Wrong. Without the element month[12][10], up to month[11][9], and the pointer p is useless. There's also the deletion of all your +10-level corresponding *. >>>More
However, it is clear that this is problematic because variable a is not assigned at all. >>>More
using system;
using ; >>>More