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 |
how to set Nth bit of variable by using MACRO
Why we write conio h in c?
how much salary u want ? why u join in our company? your domain is core sector why u prefer software ?
Write a code to generate divisors of an integer?
Write a program to exchange two variaables without temp
In a byte, what is the maximum decimal number that you can accommodate?
What is the output from this program? #include <stdio.h> void do_something(int *thisp, int that) { int the_other; the_other = 5; that = 2 + the_other; *thisp = the_other * that; } int main(void) { int first, second; first = 1; second = 2; do_something(&second, first); printf("%4d%4d\n", first, second); return 0; }
Are c and c++ the same?
What are inbuilt functions in c?
Do you know the use of fflush() function?
What are directives in c?
write a function to find whether a string is palindrome or not and how many palindrome this string contain?