Thursday 15 September 2011

c - switch without break and i++ vs ++i -


I do not understand why both of them have different output

there are two simple There are C programs

  int main () {int i; For (i = 0; i   

gives output: after zero two to two two

after switch in this case when I can change value from 0 to 1 in the variable ?

  int main () {int i; For (i = 0; i   

This interchange: a two end

< The former> switch (i ++) {}

is the same:

  int j = i; I ++; Switch (j) {}   

While

  switch (++ i) {}   

is the same As:

  i ++; Switch (i) {}    

No comments:

Post a Comment