Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Addition - fun - not what I thought
Message
De
06/07/2009 05:07:49
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
05/07/2009 09:59:48
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01410144
Message ID:
01410226
Vues:
31
>I thought it would use/fetch the value of i just before the addition would be done, ie the latest value
>
>
>int i = 1;
>i += ++i;  // 3 and not 4
>
It does but i += overload means i = i + ... thus

i += ++i; // 3 and not 4

expand to:

i = i + ++i;

There is only a new value for second parameter.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform