Please define the prefix and postfix operators | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Please define the prefix and postfix operators

increment operators

18th Feb 2017, 3:34 AM
salih ek
2 Antworten
18th Feb 2017, 4:39 AM
Hyper89
0
The prefix operator means that the increment / decrement is made before a function acts upon it, the postfix operator means that the increment / decrement is made after the function acts upon it. See the following as a demonstration: int n = 1; Console.WriteLine(n++); // returns 1 Console.WriteLine(n); // returns 2 int n = 1; Console.WriteLine(++n); // returns 2 Console.WriteLine(n) // returns 2
7th Mar 2017, 3:25 PM
Stephen Jukes