UrbanPro

Learn C Language from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What is the difference between ++var and var++?

Asked by Last Modified  

Follow 0
Answer

Please enter your answer

Professional Trainer

First one is present increment and second one is the post incremental t of the variable. Both increases value of var to one. The difference between pre and post increment is given in below example. Int a=10. Int b=++a Then a and b both have the value 11. If b=a++ Then a become 11 and b have 10...
read more
First one is present increment and second one is the post incremental t of the variable. Both increases value of var to one. The difference between pre and post increment is given in below example. Int a=10. Int b=++a Then a and b both have the value 11. If b=a++ Then a become 11 and b have 10 old value of a. read less
Comments

Experienced software professional, interested in teaching

first one is pre incrementing, second one is post incrementing. Lets take an example; int a,b=10, c; a=++b; c=b++; The values you get will be a=11; b=12, c=11; In case of pre-incrementation, increment happens first, then assignment. In case of post increment, assignment happens first and then...
read more
first one is pre incrementing, second one is post incrementing. Lets take an example; int a,b=10, c; a=++b; c=b++; The values you get will be a=11; b=12, c=11; In case of pre-incrementation, increment happens first, then assignment. In case of post increment, assignment happens first and then increment; That is why b is incremented twice but a and c got values based on when the increment is performed. read less
Comments

Professional Trainer:: Hadoop Big Data, DevOps, Perl, Python

++var -- is for pre-increment, var++ -- is for post increment you will only see the effect when you are assigning this kind of operation to another variable, say int var=10; int i=0; i=++var; // here value of var(10 is incremented and then assigned to variable i, so i and var will be 10 now) var=10; i=var++;...
read more
++var -- is for pre-increment, var++ -- is for post increment you will only see the effect when you are assigning this kind of operation to another variable, say int var=10; int i=0; i=++var; // here value of var(10 is incremented and then assigned to variable i, so i and var will be 10 now) var=10; i=var++; // here value of var is first assigned to i and then var is incremented so in this case, i=10, var=11; remember to avoid these kind of increment or decrement operators which doing math problems, as debugging will be difficult read less
Comments

Technology expert

++var is pre increment.var++ is post increment.Alone if we see pre/post increment there is no difference.variable will get incremented by 1. We can see the difference between pre/post increment only if we use with assignment operator.++var meaning is first increment then assign.var++ meaning is first...
read more
++var is pre increment.var++ is post increment.Alone if we see pre/post increment there is no difference.variable will get incremented by 1. We can see the difference between pre/post increment only if we use with assignment operator.++var meaning is first increment then assign.var++ meaning is first assign then increment. read less
Comments

Computer & Maths Professor

The ++var is pre-increment whereas var++ is post increment. In case of pre-increment, the variable's value is incremented first and the same incremented value is used in evaluation of the current expression whereas in case of post-increment, the existing value of variable is used in evaluation of the...
read more
The ++var is pre-increment whereas var++ is post increment. In case of pre-increment, the variable's value is incremented first and the same incremented value is used in evaluation of the current expression whereas in case of post-increment, the existing value of variable is used in evaluation of the current expression and than the variable is incremented. read less
Comments

Doing mathematics & computing from IIT Delhi

Let suppose var=3 and we do these two things: 1. a=5; 2. a=5; In first case, first var value will get incremented by 1 and then value 5 is assigned to the array. In second case, first value is assigned to array and then var value will get increment. In first case, value 5 is assigned to a and final...
read more
Let suppose var=3 and we do these two things: 1. a[++var]=5; 2. a[var++]=5; In first case, first var value will get incremented by 1 and then value 5 is assigned to the array. In second case, first value is assigned to array and then var value will get increment. In first case, value 5 is assigned to a[4] and final value of var is 4. In second case value 5 is assigned to a[3] and then value of var is increased to 4. In both case, final value of var is 4 but just the value of a[3] and a[4] are different. read less
Comments

website and mobile application development training, digital marketing training

++var: increase before execution var++: increase after execution
Comments

I am a teacher.

See below example; int var==10; int c,d; c=var++; # value of 'c' here is 10, var is incremented to 1 i.e. 11; var=10; #resetting 'var' value to 10 for your better understanding. d=++var; # value of 'd' here is 11. Even var value also 11. in case of ++var, value of 'var' will be first incremented...
read more
See below example; int var==10; int c,d; c=var++; # value of 'c' here is 10, var is incremented to 1 i.e. 11; var=10; #resetting 'var' value to 10 for your better understanding. d=++var; # value of 'd' here is 11. Even var value also 11. in case of ++var, value of 'var' will be first incremented and then assigned to the lvalue (in above e.g. 'd') in case of var++, first 'var' value will be assigned to the lvalue and then 'var' will be incremented (in above e.g. its 'c'). Kindly let me know if you need still more clarification. read less
Comments

Tuition Teacher

++var is pre- increment operator. For eg-if var=5 then ++5 means 5+1 i.e. 5 will first increase by 1, become 6 and then will do any work. But var++ means post-increment operator. For eg.- if var=5, then 5 will first do any work like entering a loop or addition, multiplication, etc. after this value of...
read more
++var is pre- increment operator. For eg-if var=5 then ++5 means 5+1 i.e. 5 will first increase by 1, become 6 and then will do any work. But var++ means post-increment operator. For eg.- if var=5, then 5 will first do any work like entering a loop or addition, multiplication, etc. after this value of 5 will increase by 1. read less
Comments

Python and Unix Professional(10 years IT Exp)

++var means first value will increase then var will print and in var++ first var value will print then increment take place. main() { i=2; printf("Value of i++ ++i",i++,++i); } output i++ ++i
Comments

View 18 more Answers

Related Questions

What is the best website to learn c language?
In case of problems you will face while making programs, you may take help of google. There may be the situation when you need a helping hand to make clear the basic concepts of programming and internal...
Nom
Is it necessary to learn the C language and also C++ before joining an engineering college?
it is not necessary to learn C and C++, but if you want to make your are career in computer then learn C & C++ because these are basic computer language.
J.k.kavyadharshini
How many programs are in the C language?
Here, we have provided 100+ C programming examples in different categories like basic C Programs, Fibonacci series in C, String, Array, Base Conversion, Pattern Printing, Pointers, etc.
Muskan
0 0
6
Which websites are best to learn C programming?
There are several reputable websites where you can learn C programming. Here are some popular ones: GeeksforGeeks (geeksforgeeks.org): Offers a wide range of tutorials, practice problems, and articles...
Sarath Chandra
0 0
5
What is the cost of the course?What kind of questions are asked for interviews from C language??
Course fee depends on the depth of the course. Interview question are mainly from DS(Data Structure) importantly linked list, BST tree,array and except this pointer, string, function and recursion is important.
Chandana

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

PRACTISE makes you PERFECT ; ; ; There is no SUBSTITUTE for HARD WORK ;;;;Breathe SUCCESS like OXYGEN
Proper Planning ( reg what portions to be covered today) revising today's class portions & clarifying doubts solving Maths problems regularly ,noting down formulae separately trying to understand...

Variables
Variables in C Language:A variable is a name that may be used to store a data value. Unlike constant, variables are changeable, we can change value of a variable during execution of a program. A programmer...

C Program-Vowels and Consonants
/*WAP to print the character entered by user is a vowel or consonant*/ //Header files #include<stdio.h>#include<conio.h> //Main functionvoid main(){ char c; //Function for clearing screen...

Programming Practice Technique
Any Programming Language required an Algorithm. Algorithm - It is the finite set of instructions in which each and every instruction has the meaning, instructions are not ambiguous and all the instructions...

Creating First Program Using C Language
Step 1: Install and setup Turbo C compiler on your computer. Step 2: Open Turbo C from your Desktop or Programs menu. Select “File” from menu bar and select option “New”. Step...

Recommended Articles

Lasya Infotech is a Hyderabad based IT training institute founded in 2016 by O Venkat. Believing in his innovation, passion and persistence and with a diverse blend of experience, he started his brainchild to deliver exemplary professional courses to aspiring candidates by honing their skills. Ever since the institute envisions...

Read full article >

Brilliant Academy is one of the reputed institutes for B.Tech tuition classes. This institute is specialised in delivering quality tuition classes for B.E, Engineering - all streams and Engineering diploma courses. Incorporated in 2012, Brillant Academy is a brainchild of Mr Jagadeesh. The main motto of the academy is to...

Read full article >

Applications engineering is a hot trend in the current IT market.  An applications engineer is responsible for designing and application of technology products relating to various aspects of computing. To accomplish this, he/she has to work collaboratively with the company’s manufacturing, marketing, sales, and customer...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Looking for C Language Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C Language Classes?

The best tutors for C Language Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn C Language with the Best Tutors

The best Tutors for C Language Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more