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 'bus error'?
What is pass by value in c?
What is the easiest sorting method to use?
How to add two numbers without using semicolon at runtime
void main() { char c; while(c=getchar()!='\n') printf("%d",c); } o/p=11 why?
Tell me when is a void pointer used?
what is data structure.in linear and non linear data structures which one is better?Explain
how can use subset in c program and give more example
what are enumerations in C
What is an lvalue?
How can I change their mode to binary?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above