Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
++a vs a++ and calculations around different variables
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//'main' method must be in a class 'Rextester'. //Compiler version 1.8.0_111 import java.util.*; import java.lang.*; class Rextester { public static void main(String args[]) { int a,b=13,c; a=++b*2; // a=14*2=28 System.out.println("a="+a+", b="+b); c=a++ + b; // a=29 // b=14 // c=28+14=42 System.out.println("a="+a+", b="+b+", c="+c); b=++a + a-- - c++ - --c; // a=29 // b=(++a=30) + (a--=29 - (c++=42) - (--c=41)) so b=30+29-42-41=-24 // c=42 System.out.println("a="+a+", b="+b+", c="+c); } }
[
+
]
Show input
Compilation time: 1.25 sec, absolute running time: 0.24 sec, cpu time: 0.24 sec, memory peak: 18 Mb, absolute service time: 1,51 sec
edit mode
|
history
|
discussion
a=28, b=14 a=29, b=14, c=42 a=29, b=-24, c=42