我之前学C时,都是先进行赋值运算,再进行输出,可是在java上可以直接从输出部分写赋值。
c也可以的,printf("%d",(a=5));你可以试一下
#include <stdio.h>
int main()
{
int one = 10;
int two = 20;
int three = 0;
printf("three = one + two ==> %d\n", three=one+two);
printf("three += one ==> %d\n", three+=one);
printf("three -= one ==> %d\n", three-=one);
printf("three *= one ==> %d\n", three*=one);
printf("three /= one ==> %d\n", three/=one);
printf("three %= one ==> %d\n", three%=one);
return 0;
}C也可以。