1. ## expression question

I have a question is *++p and ++*p legal expressions i have seen *++p used however i have not seen ++*p put in to use

2. Yes, they're both legal. One alters the address of p and then dereferences (which is kind of useless by itself), and the other dereferences p and then alters the result.

char a[ ] = "cba", *p = a;
then ++*P would b equal to c right??i am confused now

4. the value thats stored in p (*p) would be the first element in the array, so it would be 'c'. if you increment this value (++*p) it will add one to 'c' so the result is 'd'

5. Start slowly when going through it. First let's turn it into a program:

Code:
```#include <stdio.h>

int main(void)
{
char a[ ] = "cba";
char *p = a;

printf("*p = &#37;c\n",*p);
++*p;
printf("*p = %c\n",*p);

return 0;
}```
Output:

Code:
```*p = c
*p = d```
So why?

Basically you have an array of chars that are like this in memory:

Code:
`'c', 'b', 'a', '\0'`
You set p to point to this array. That means p holds the address of a, and can be treated in some ways as if it's a.

Arrays are kind of special when you consider how the relationship they share with pointers. When you use an array name, you're usually referencing a pointer to the first element of the array. This is important. Pointing p to a actually points p at the first element of a.

So what does ++*p do?

First of all, it takes p, and dereferences it, and then performs the ++ on whatever the result was. This is equivalent of typing this out:

Code:
`++(*p);`
This means that you're grabbing where p points at and altering what it points at to be one more than it used to be.

Since p points at the memory location of letter c inside the array, you end up ++ing the letter c. This causes c to be d, and the array a to look like this in memory:

Code:
`'d', 'b', 'a', '\0'`
Hope this helps.

Edit: Oh, well, beaten again. lol..