1. ## Pointer Arithmetic trouble

My code is designed to intake a pointer list, which will point to an array, and put all the negative values into a new pointer first, then followed by all the positive values into the new pointer second.
Code:
```void rearrange(int* list, int* new, int size)
{
int i, j=0, temp;
for(i=0; i<size; i++)
{
if(*(list + i) < 0)
{
temp= *(list + i); /* I am under the impression that we
should first "create a house" or an
address for the pointer new to look at*/

(new + j)=&temp; /*This code line fails with the message
lvalue required as left operand of
assignment*/
j++;                   /* Keeps the assignment going along the
pointer new */
}
}
for(i=0; i<size; i++)
{
if(*(list + i) > 0)
{
temp = *(list + i);
new = &temp;
j++;
}
}
}```
What is my problem?!!!!!
Thank You 2. put all the negative values into a new pointer first
Code:
```         (new + j)=&temp; /*This code line fails with the message
lvalue required as left operand of
assignment*/```
You are assigning the address of temp to the address of new + j. IOW, you're attempting to change the address pointed to by new + j. I'm pretty sure that's not what you want since temp is locally declared and will disappear once the function returns and you can't change the address of new + j. You need to dereference new + j:

Code:
`*(new + j) = temp;`
That will assign the value in temp to the address pointed to by new + j. This copies the contents, rather than location of contents. 3. Thank you very much Popular pages Recent additions assignments, pointer, pointer arithmetic 