Why is the integer `j` returning a `i`?

The * operator declares s as a pointer. This means that it will contain the address of the variable assigned. Here the value of the pointer s is i i.e, the first element of the string “iLoveC”. When you use post increment s[j++] it is equivalent to s[0]=’i’ but when you use s[++j] it is equivalent to s[1]=’L’

See this link http://www.programiz.com/c-programming/c-pointers-arrays
and start by readind some books.

Browse More Popular Posts

Leave a Comment