void main()
{
int i=5;
printf("%d",i+++++i);
}
Answer Posted / sheetal
gives error
"error C2105: '++' needs l-value"
because it parses above expression in "((i++)++)+i), so in
2nd unary operator it searches for l-value.
If we modify above pgm into following way:-
void main()
{
int i=5;
printf("%d",((i++)+(++i)));
}
it will give answer 12.
because once last pre-unary increment operator is operated,
i is incremented to 6 and 6+6 = 12.
if we put one more print for i's value, it will give i =7.
because first post-increment operator is operated after
first printf statement as follows.
void main()
{
int i=5;
printf("%d",((i++)+(++i)));
printf("%d\n",i); // ===> i =7
}
Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
Explain what’s a signal? Explain what do I use signals for?
The file stdio.h, what does it contain?
Why #include is used in c language?
In cryptography, you could often break the algorithm if you know what was the original (plain) text that was encoded into the current ciphertext. This is called the plain text attack. In this simple problem, we illustrate the plain text attack on a simple substitution cipher encryption, where you know each letter has been substituted with a different letter from the alphabet but you don’t know what that letter is. You are given the cipherText as the input string to the function getwordSets(). You know that a plain text "AMMUNITION" occurs somewhere in this cipher text. Now, you have to find out which sets of characters corresponds to the encrypted form of the "AMMUNITION". You can assume that the encryption follows simple substitution only. [Hint: You could use the pattern in the "AMMUNITION" like MM occurring twice together to identify this]
What does do in c?
How do you generate random numbers in C?
What are the different types of C instructions?
What extern c means?
How to draw the flowchart for structure programs?
How can you find the exact size of a data type in c?
What is the purpose of void pointer?
how do you execute a c program in unix.
Is fortran still used today?
HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????
What is linear search?