C# Programming - Operators - Discussion
Discussion Forum : Operators - General Questions (Q.No. 1)
1.
Which of the following are the correct ways to increment the value of variable a by 1?
- ++a++;
- a += 1;
- a ++ 1;
- a = a +1;
- a = +1;
Discussion:
20 comments Page 2 of 2.
Deepak verma said:
9 years ago
This += is known as shorthand operator which same as variable = variable +1.
(1)
Venkat said:
1 decade ago
a += 1 means a=a+1; //so it is correct
a = a+1; //it is also correct
a = a+1; //it is also correct
Gowrishangar said:
1 decade ago
In the option 4 a= +1 is correct or not & why?
Srinivas said:
1 decade ago
Can any body tell me please what multithreading?
Anushiya said:
1 decade ago
a=a+1 is is correct we can also declare as a+=1
Anandhajothi.s said:
1 decade ago
In the option 4 a=+ correct or not and why?
Srinivas said:
1 decade ago
What is difference between a++1 and a = +1?
(1)
Vedhu said:
1 decade ago
a+=1 also mean by a=a+1, so both are same.
Krishna said:
1 decade ago
It was repeating and returning the zero.
Rose said:
1 decade ago
++a is true. What about ++a+1?
a = a++1.
a = a++1.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers