i = i ++; different results under C ++ and Java.

xiaoxiao2021-03-06  55

There is a statement

INT i = 0;

i = i ;

What is the value of i?

Different results in C and Java. The result of C is 1. The result in Java is 0. It is probably caused by this different root cause due to the different ideas of C and Java. C is a process-oriented language, the meaning of operators is to add the target value after executing the current statement. Java is a pure object-oriented. All operators are treated as a function. The operators in Java and the overloaded operators in C are very similar.

Such as

Int Operation (INT & I)

{

INT TEMP = I;

i ;

Return Temp;

}

This makes the structure of the statement given by the beginning.

转载请注明原文地址:https://www.9cbs.com/read-85098.html

New Post(0)