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

Answer Posted / sailaxmi

++x is pre-increment

say for example
the value of a=1
int a,r;
r= ++a;

now the value of "a" is incremented to 2 n then assigned to r...


x++ is post increment
say for exmaple

the value of a is 3

int a,r;
r=a++;

the value of a(initially 3) will be assigned to r..... n
then the value of "a" gets incremented to 4.

Is This Answer Correct ?    6 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Create a program to read two random data set in two files named data1.txt and data2.txt manifold contains integer numbers, whereas data2.txt file contains the float type numbers. Simpanlahmasing each into 2 pieces of data that is an array of type integer array and an array of type float, then calculate the average numbers in the second array.

2152


output for printf("printf");

1985


what mean void creat_object?in public class in this code class A{ public: int x; A(){ cout << endl<< "Constructor A";} ~A(){ cout << endl<< "Destructor A, x is\t"<< x;} }; void create_object(); void main() { A a; a.x=10; { A c; c.x=20; } create_object(); } void create_object() { A b; b.x=30; }

2069


Question 1: Implement a base class Appointment and derived classes Onetime, Daily, Weekly, and Monthly. An appointment has a description (for example, “see the dentist”) and a date and time. Write a virtual function occurs_on(int year, int month, int day) that checks whether the appointment occurs on that date. For example, for a monthly appointment, you must check whether the day of the month matches. Then fill a vector of Appointment* with a mixture of appointments. Have the user enter a date and print out all appointments that happen on that date. *This Should Be Done IN C++

552


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

2216






i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.

1970


Code for Two Classes for Doing Gzip in Memory?

2814


how to take time as input in the format (12:02:13) from user so that controls remains between these columns?

1820


create a stucture student containing field for roll no,class,year and marks.create 10 student annd store them in a file

2220


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


We need to write the function to check the password entered is correct or not based on the following conditions.. a) It must have atleast one lower case character and one digit. b)It must not have any Upper case characters and any special characters c) length should be b/w 5-12. d) It should not have any same immediate patterns like abcanan1 : not acceptable coz of an an pattern abc11se: not acceptable, coz of pattern 11 123sd123 : acceptable, as not immediate pattern adfasdsdf : not acceptable, as no digits Aasdfasd12: not acceptable, as have uppercase character

3957


Teta-Omeg-Big-Oh Show that f(n) = n2 + 3n3 is ;(n3).

3193


How to Split Strings with Regex in Managed C++ Applications?

3128


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

2746


how to write a program that opens a file and display in reverse order?

2567