What will be the output of
x++ + ++x?
Answers were Sorted based on User's Feedback
Answer / naveenkumari
here we can see two types of increments pre and post
increment . since x++ is post increment first the value is
assigned and then increments but in case of ++x first the
value is incremented and then assigned since x is not
initialized with any value the above expression gives a
garbage value .For example if x is initialized with a value
"1" then the this expression gives the output as "3"
| Is This Answer Correct ? | 4 Yes | 4 No |
Answer / sujan
let x=1,here it starts with x++, so first x takes value 1 and then it increments to 2.. later ++x.. here x is incremented first i.e.,x=3 and then added to previous value..ie., 1+3
o/p is 4
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sairoong.l@drsomchai.net
static void Job13(Args _args)
{
Dialog dlg;
DialogField dlgField;
;
dlg = new Dialog("test");
dlg.addGroup("test");
dlgField = dlg.addField(TypeId(CustAccount), "test");
if(dlg.run())
info(dlgField.value());
}
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer is 2x+2. For Ex: if x is 2 result is 2(2)+2 = 6.
| Is This Answer Correct ? | 7 Yes | 8 No |
Answer / srinivas
for this what is the input value of x.First of all we have
to give the input value of x.
if x = 1 then answer would be
main();
int x=1,y.
y = x++ + ++x.
printf /n'%d',y.
here y = 3
| Is This Answer Correct ? | 11 Yes | 15 No |
Answer / pardeep
answer illl always be 4
value of x ill be 2+2
it willincrement only in 2nd case th ++x
| Is This Answer Correct ? | 4 Yes | 13 No |
Answer / mortal
x++ starts with x and ++x starts with x+1,hence if x=1 then
ans. is 3.
| Is This Answer Correct ? | 5 Yes | 15 No |
what is the difference between #include<> and #include”…”?
Explain how can a program be made to print the name of a source file where an error occurs?
how to return 1000 variables from functio9n in c?plz give me code also
wat is the output int main() { char s1[]="Hello"; char s2[]="Hello"; if(s1==s2) printf("Same"); else printf("Diff"); }
implement NAND gate logic in C code without using any bitwise operatior.
write a program to display the numbers having digit 9 in the given range from 1 to 100
Write a C program to read the internal test marks of 25 students in a class and show the number of students who have scored more than 50% in the test. Make necessary assumptions.
C program to find all possible outcomes of a dice?
What are 3 types of structures?
How can I read in an object file and jump to locations in it?
write a program for egyptian fractions in c?
how can i get the output 54321 4321 321 21 1 in c programming........???? pls help......