Oct 28, 2014 at 3:40pm UTC
*c++ is interpreted as *(c++). You can't use the increment operator on an array like that.
Oct 28, 2014 at 4:07pm UTC
why don't binary operators work like unary operands in these cases..?
Oct 28, 2014 at 4:32pm UTC
Because it's trying to increment c, which is an array. I think you meant (*c)++
, which will increment c[0]
Oct 28, 2014 at 7:10pm UTC
Array names are constant pointers ,
so simple c++
is illegal in the above code ;
but if *(c+1)
is legal why not *(c++)
or *(++c)
as c+1 == ++c
please clear my doubt and tell me how i am wrong ?
Last edited on Oct 28, 2014 at 7:13pm UTC
Oct 28, 2014 at 9:52pm UTC
c+1
is not the same as c++
because c++
modifies c and c+1
does not. The key here is that you can't change c.
Oct 28, 2014 at 9:57pm UTC
ohh yes c++
is equivalent to c=c+1
or c += 1
but in *(c+1)
i am not modifying c…and c remains constant
Thanks!!
Last edited on Oct 28, 2014 at 9:58pm UTC