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.
What is my problem?!!!!!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++; } } }
Thank You



LinkBack URL
About LinkBacks


