العودة إلى  مدرسة الكمبيوتر   قسم البرمجة    الصفحة الأولى

Assignment Operators:  =, +=, -=, *=, /=, %=, >>=, <<=, &=, ^=, |=

assignment-expression :

conditional-expression
unary-expression assignment-operator assignment-expression

An assignment operation assigns the value of the right-hand operand to the storage location named by the left-hand operand. Therefore, the left-hand operand of an assignment operation must be a modifiable l-value. After the assignment, an assignment expression has the value of the left operand but is not an l-value. The assignment-operator is one of the following:

Operator Operation Performed
= Simple assignment
*= Multiplication assignment
/= Division assignment
%= Remainder assignment
+= Addition assignment
-= Subtraction assignment
<<= Left-shift assignment
>>= Right-shift assignment
&= Bitwise-AND assignment
|= Bitwise-inclusive-OR assignment
^= Bitwise-exclusive-OR assignment


 

Example

In the following example, the addition assignment operator (+=) is used to add 3 to nNumber:

// Example of the addition assignment operator
int nNumber=1;

nNumber += 3;    // nNumber now is 4
 
 طباعة المقال العودة إلى  مدرسة الكمبيوتر   قسم البرمجة    الصفحة الأولى
Syria
سورية
Amrit
عمريت
أرواد
طرطوس
صور من طرطوس
صور من سورية
للسيدات فقط
معجم الكمبيوتر
أدب وفكر
المجلة الطبية
المعلومات العامة
لمحة عن طرطوس
الموضة النسائية
مدرسة الكمبيوتر
 © 2002-2012 LBCInformation Corporation. All rights reserved م حنا عطا لحود.