- Posted On 31 July 2014
- By
- In Programming
In this post I will share some information about incremental operator ++ of C#. In many interviews this question has been already asked and still it is one of the favorite question for some of the interviewers i.e. What is the difference between i++ and ++I in C#?
So let’s check what the difference is.
In both the cases value of “i” gets incremented but the difference is i++ - It’s a type of post increment. When you write i++ it means “give me the value of i and then increment its value”, on the other hand ++i means “increment the value of i and then give me the updated value”.
Let’s understand using some example.
If you write a code like below.
int i = 2; int j= 2; int k = i++; int l = ++j;
In above case, at the end, values of i,j,k and l will be like following
i = 3
j = 3
k =2
l = 3
So by above example you can easily understand how pre increment and post increment works.
If not and having some queries do share in comment section below. If you have something positive to add this short but useful post then do share that too. Thanks.
- Tags :
- InterviewQuestions
- CSharp
Top 10 Visual Studio things which can boost developers coding speed
Visual Studio 2012 provides some coding features by which you can code faster if use them properly. This post will cover top 10 things among them to boost your development speed.
Visual Studio 2008 Shell and TFS integration
Visual Studio 2008 Shell and TFS integration is the problem for all newbies of BIDS and TFS. Here is the solution.
How to call click or any event only once in jQuery
Know how to execute an click event or any event only once for any element in jQuery. Perform action only once and even not required to unbind event.
Assembla - Free and private repository to manage your source code online with SVN subversion hosting
With Assembla you can share source code with others online. Free & Private source code repository with SVN Subversion, Git & Perforce Hosting.
Best CSS Gradient background generator tools online
Here are some best CSS gradient background code generator online tools using which you can create a cross browser css code for gradient backgrounds.