Why doesn't the code "a[i] = i++;" work?
Answers were Sorted based on User's Feedback
Answer / guest
The variable i is both referenced and modified in the same
expression.
| Is This Answer Correct ? | 11 Yes | 4 No |
Answer / abdur rab
The answer from wikipedia
Sequence point comes into play when the same variable is
modified more than once. An often-cited example is the
expression i=i++, which both assigns i to itself and
increments i; what is the final value of i? Language
definitions might specify one of the possible behaviors or
simply say the behavior is undefined. In C and C++,
evaluating such an expression yields undefined behavior.
| Is This Answer Correct ? | 6 Yes | 2 No |
Answer / vignesh1988i
this line will work.... first the value of i will be in the array and then i will get incremented
| Is This Answer Correct ? | 11 Yes | 18 No |
Explain how can you be sure that a program follows the ansi c standard?
What is %lu in c?
What are header files in c programming?
how does a general function , that accepts an array as a parameter, "knows" the size of the array ? How should it define it parameters list ?
Write a program that takes a 5 digit number and calculates 2 power that number and prints it
what is call by value and call by reference
program to find the second largest word in a paragraph amongst all words that repeat more thn twice
what is the role you expect in software industry?
please give me some tips for the selection in TCS.
How to Clear last bit if it 1 using Macro TURN_OFF_BIT_LAST
How do you initialize function pointers? Give an example?
What is the best way of making my program efficient?