what is the diffrence between ++x , x++ pleaaaaase ???
Answers were Sorted based on User's Feedback
Answer / dallasnorth40
++ before the variable increments the variable before the
value is taken/used.
++ after the variable takes/uses the value, then increments.
Given:
int x = 5;
int y = 0;
y = x++;
This will leave y = 5 and x = 6.
y = ++x;
This will leave y = 6 and x = 6.
| Is This Answer Correct ? | 27 Yes | 3 No |
Answer / abhishek
This means if you declare the value for x=2 and used in
loop, while printing the value of ++x it will print 3 and if
used x++ then it will print 2 and then increment the value
for x and then next rotation it will print 3.
eg.1)
.....
..
..
++x OR x++;
printf("value of " ++x OR x++);
...
..
..
| Is This Answer Correct ? | 23 Yes | 3 No |
++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 |
Answer / 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 |
Answer / chandrakant rohi
++x
it means pre-increament ,before execute the x first it increment
Ex int x=10;
printf("%d",++x);
ans=11
and
x++ means post_increament,first excute the statment and then increment ;
Ex
int x=10;
printf("%d",x++);
ans =10;
| Is This Answer Correct ? | 5 Yes | 2 No |
Answer / prabu
++x mean pre increament
eample:
for(i=1;i<=1;i++)
{
printf("i value is=",i);
}
the output: i=1
x++ mean post increament
example:
for(i=1;i<=1;++1)
{
printf("i value is =",i);
}
the output: i=2
| Is This Answer Correct ? | 2 Yes | 2 No |
how to find out the maximum number out of the three inputs.
6 Answers ABC, Apple, C3I, HP, TCS,
Write a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors.
5 Answers ADP, Amazon, HCL, IBM, Infosys, Satyam, TCS, Vimukti Technologies,
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++
using repetition structure. Write a c program that will accept five numbers. The program should count and output the total count of even numbers and total count of add numbers.
Perform the functionality of 2-D array through 1-D array and in it the functions to be performed were: (1) Display the array in 2-D format (2) Display a particular element (3) Display a particular row (4) Display a particular column
Display Pattern: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 …
Subsets Write an algorithm that prints out all the subsets of 3 elements of a set of n elements. The elements of the set are stored in a list that is the input to the algorithm. (Since it is a set, you may assume all elements in the list are distinct.)
1 Answers CSC, Qatar University,
write a function – oriented program that calculates the sum of the squares from 1 to n. thus, if the input is 3, the output is 14
swap prog
An array of size 5X5 is given to us. The elements from 1 to 25 are to be inserted in the array, such that starting from a particular position for an element i, the next element i+1can be inserted only at the mentioned positions (u,v), and if these all positions are occupied then it returns giving a count of how many positions have been occupied in the array: (u,v) = (x+/-3 , y) (u,v) = (x , y+/-3) (u,v) = (x+/-2 , y+/-2). Example: if the starting element is 1 with the given positions (1,2), then next element 2 can be placed at any one of the positions marked with *. _ _ _ _ _ 1 _ _ _ * _ _ _ _ _ _ _ * _ _ * _ _ _ _
Counting in Lojban, an artificial language developed over the last fourty years, is easier than in most languages The numbers from zero to nine are: 0 no 1 pa 2 re 3 ci 4 vo 5 mk 6 xa 7 ze 8 bi 9 so Larger numbers are created by gluing the digit togather. For Examle 123 is pareci Write a program that reads in a lojban string(representing a no less than or equal to 1,000,000) and output it in numbers.
Min-Max Write an algorithm that finds both the smallest and largest numbers in a list of n numbers and with complexity T(n) is at most about (1.5)n comparisons.
10 Answers ABC, College School Exams Tests, ITC Infotech, Kyambogo University, Qatar University,