Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


Why doesn't the code "a[i] = i++;" work?

Answers were Sorted based on User's Feedback



Why doesn't the code "a[i] = i++;" work?..

Answer / guest

The variable i is both referenced and modified in the same
expression.

Is This Answer Correct ?    10 Yes 4 No

Why doesn't the code "a[i] = i++;" work?..

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

Why doesn't the code "a[i] = i++;" work?..

Answer / kk

undefined behaviour

Is This Answer Correct ?    7 Yes 3 No

Why doesn't the code "a[i] = i++;" work?..

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

Post New Answer



More C Interview Questions

Explain why C language is procedural?

0 Answers   GE,


What are the advantages of using linked list for tree construction?

0 Answers  


What is union and structure?

0 Answers  


What is the scope of local variable in c?

0 Answers  


What is the difference between the local variable and global variable in c?

0 Answers  






What are control structures? What are the different types?

0 Answers  


What is the use of static variable in c?

0 Answers  


what r the cpu registers r ther?

1 Answers  


WRITE A C PROGRAM FOR PRINT "RHOMBUS" STRUCTURE . Example: Enter the numbers :3 * * * * * * * *

3 Answers   Infosys, TCS,


What does nil mean in c?

0 Answers  


How to calculate sum

2 Answers  


Are bit fields portable?

0 Answers   EXL,






Categories