what is the diffrence between ++x , x++ pleaaaaase ???

Answer Posted / divya prabhu

++x means preincrement x, and then assign .
i.e
first increment x ==> x+1 and then assign the incremented
value back to x ==> x=x+1


x++ means postincrement x, and then assign .
i.e
first assign value of x to x==> x and then increment value of
x, x ==> x+1

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)

2937


1+1/2!+1/3!+...+1/n!

1945


Code for Easily Using Hash Table?

2391


Write a C/C++ program that connects to a MySQL server and displays the global TIMEZONE.

4579


i don't know about working of nested for loop can any one help me

1794






What output does this program generate as shown? Why? class A { A() { cout << "A::A()" << endl; } ~A() { cout << "A::~A()" << endl; throw "A::exception"; } }; class B { B() { cout << "B::B()" << endl; throw "B::exception"; } ~B() { cout << "B::~B()"; } }; int main(int, char**) { try { cout << "Entering try...catch block" << endl; A objectA; B objectB; cout << "Exiting try...catch block" << endl; } catch (char* ex) { cout << ex << endl; } return 0; }

580


write a function that allocates memory for a single data type passed as a parameter.the function uses the new operator and return a pointer to the allocated memory.the function must catch and handle any exception during allocation

2407


Performance Algorithm A performs 10n2 basic operations and algorithm B performs 300 lg n basic operations. For what value of n does algorithm B start to show its better performance?

7344


3. Program to find the Sum of give series. a. (1)+(1+2)+(1+2+3)+(1+2+3+4)+……………………………….. b. 1/1+1/9+1/25+1/49+……………...

4355


develop a program to calculate and print body mass index for 200 employees

2216


How to swap two ASCII numbers?

2451


can you please write a program for deadlock that can detect deadlock and to prevent deadlock.

2748


A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect

2407


Write a (n) algorithm that sorts n distinct integers, ranging in size between 1 and kn inclusive, where k is a constant positive integer. (Hint: Use a kn-element array.)

4453


write a program using virtual function to find the transposing of a square matrix?

2845