Question: If we have a `char *hello` - and the string is `"hello"`

and i do 

```
char *ptr;
ptr = hello;

```

then ptr will be pointing at `'h'`, correct?

Now I have just done an assignmnet in this and completed it using the following terms

if i wanted to move the pointer to the next chatachter i would just do `ptr++`. If i wanted to use the value of the pointer for some check, i would use `if(*ptr == '\0')...`

When i was doing the assignmnets our teacher gave us some pre built methods, and they used stuff like 

```
*string++ = *s++;

```

ok, so why would we want to do `*string` (which gets a value) - and combine it with `++`

I hope i make sense in explaining what is not clear. Its just I managed to do the whole assignment with ptr++ to move to next element or \*ptr to check its value

Answer: 
> 
> so why would we want to do \*string(which gets a value) - and combine it with ++
> 
> 
> 

When `*string` is on the left hand side of the equals, it doesn't get the value, it **sets** the value.

The statement `*string++ = *s++;` is equivalent to:

```
*string = *s;
s++;
string++;

```

This is because `x++` is the [postfix increment operator](http://msdn.microsoft.com/en-us/library/e1e3921c.aspx) (as opposed to `++x` which is the prefix increment operator). The pointer x is updated but the value that `x` was originally pointing to is used in the expression.

Personally I'd say that the one-liner is more confusing to read and you should generally try to avoid complex expressions with side-effects. But in this case it's a fairly standard idiom in C, so you might as well get used to it.
> 
> then ptr will be pointing at h, correct?
> 
> 
> 

Yes, correct.

> 
> ok, so why would we want to do \*string(which gets a value)
> 
> 
> 

The '\*' doesn't necessarily get a value: it may set a value, depending on which side of the '=' sign it is.

```
char *ptr;
ptr = "hello";
char firstLetter = *ptr; //get the value: now firstLetter contains 'h'
*ptr = 'w'; //set the value: now ptr is pointing to "wello".

```

Combining \* with ++ means that you do one after the other:

* On the right-hand side, '\*s++' means "get the value to which s is pointing, and then increment the s pointer".
* On the left-hand side, '\*string++' means "set the value to which string is pointing, and then increment the string pointer".

Combining them into a single statement simply a shorter, more compact (but functionally equivalent) way to write:

```
*string = *s;
string++;
s++;

```