main()
{ int i;
printf("%d",((i=1)*i-- - --i*(i=-3)*i++ + ++i));
}
ans is 24 bt how?pls tell smbody............
Answers were Sorted based on User's Feedback
Answer / gorgeousgirl
Answer: 34
confirm the answer with http://codepad.org/PudiZIaS
Explanation:
by order of precedence, parenthesis hav highest priority
so
(i=1)*i-- - --i*(i=-3)*i++ + ++i
i=1 i=-3
now, i=-3
after assignment operations the expr becomes,
>(i)*i-- - --i*(i)*i++ + ++i
next higher priority is for auto-in/decrement
omitting post in/decrement(as they hav effect only after
this line of code), we get,
> i*i - --i*i*i + ++i
the associativity for printf statement is from right to left
so ++i is executed first before --i where i=-3
> i*i - --i*i*i + -2
now i=-2
> i*i - -3*i*i + -2
now i =-3
next precedence is for multiplication
> -3*-3
-
-3*-3*-3
+
-2
> 9 - -27 + -2
> 9 + 27 -2
> 9 + 25
> 34
Is This Answer Correct ? | 3 Yes | 0 No |
Answer / sureshb
value is 26 and i value is -2.
Intiallay i=1 is assiged.
((i=1)*i--) 1st expression = 1 postfix decrement evaluates at the end.
now i=1
--i => 0. 2nd expression
i=-3 assigned new value 3rd expression.
-3*-3 => 9 *(-3) => -27
++ post increment done at the end
-(-27) = 27.
1+ 27 =>28
now i is -3.
++i => -2;
28-2= 26.
i=-2;
post increment and decrement happens. finaaly i = -2.
Is This Answer Correct ? | 5 Yes | 3 No |
Answer / rama krishna sidhartha
Actually answer is not 24 it is -7567. When i executed this
in the turbo c compiler i got the answer like that.
Is This Answer Correct ? | 0 Yes | 2 No |
Write a C/C++ program that connects to a MySQL server and checks intrusion attempts every 5 minutes. If an intrusion attempt is detected beep the internal speaker to alert the administrator. A high number of aborted connects to MySQL at a point in time may be used as a basis of an intrusion.
2 Answers Drona Solutions, Infosys, Vodafone, Webyog,
What are called c variables?
Read N characters in to an array . Use functions to do all problems and pass the address of array to function. 1. Print only the alphabets . If in upper case print in lower case vice versa. 2. Enter alphanumeric characters and form 2 array alphaets and digits.Also print the count of each array. 3. Find the count of a certain character. 4. Print the positions where a certain character occured. 5. Print the characters between successive array elements. 6. Find the largest and smallest charcter. How many times it each one occured. 7. Enter a certain range. Print out the array elements which occured between these range. 8. Reverse a character array without using another array. 9. Reverse an array region. 10. Replace a the array elements with it next character . Use a after z. 11. Code the array element with certain character as first alphabet. 12. Duplicate all the vowels in a character array. What is the new count. 13. Delete the vowels in a character array. What is the new array count. 14. Print the count of all characters in the array. 15. Enter n alphabets and store a upto tht charcter in array.What is the array count? 16. Sort a character array. 17. Merge 2 character arrays largearray,smallarray. 18. Find the pair with largest number of characters in between. 19. Find the numerical value of a charcter array. 20. Store n numeral characters in an arrray. Insert another numeral character in a certain position. 21. Insert a character in a sorted array. 22. Merge 2 sorted arrays in sorted fashion. 23. Duplicate the least occuring character. 24. Write a menu driven program to circular right/left shift an array of n elements. 25. Is the character array palindrome? if not make it palindrome. 26. Concatenate the first n charaters to the end of the string. 27. Print all n group of chracters which are palindrome. 28. Concatneate the reverse of last n characters to the array.
What is const and volatile in c?
What is array within structure?
int a=20; int b=30; int c=40; printf("%d%d%d"); what will be the output?
in one file global variable int i; is declared as static. In another file it is extern int i=100; Is this valid ?
Define VARIABLE?
What is c++ used for today?
wats SIZE_T meant for?
All technical questions
write an algorithm to display a square matrix.