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 |
program to convert a integer to string in c language'
Explain argument and its types.
if a is an integer variable, a=5/2; will return a value a) 2.5 b) 3 c) 2 d) 0
How to reverse alternate words in a given line of string For Eg: my name is narasimha output : my eman is ahmisaran
main() { int a[10]; printf("%d",*a+1-*a+3); }
What are the 5 elements of structure?
Using which language Test cases are added in .ptu file of RTRT unit testing???
why division operator not work in case of float constant?
how can i sort numbers from ascending order and descending order using turbo c..
Given an unsigned integer, find if the number is power of 2?
If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above
WHAT IS MEANT BY LIFE?