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


Please Help Members By Posting Answers For Below Questions

Explain what’s a signal? Explain what do I use signals for?

616


The file stdio.h, what does it contain?

670


Why #include is used in c language?

605


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]

1961


What does do in c?

612






How do you generate random numbers in C?

663


What are the different types of C instructions?

681


What extern c means?

547


How to draw the flowchart for structure programs?

8764


How can you find the exact size of a data type in c?

603


What is the purpose of void pointer?

603


how do you execute a c program in unix.

641


Is fortran still used today?

608


HOW TO SOLVE A NUMERICAL OF LRU IN OS ??????

2273


What is linear search?

678