ok so i have an array like this which contains an id, a myState of type State and pointer next which points to the next id
struct PCB
{
int id;
STATE myState;
Process *next;
};
i have the following function which should decrement all the current values of int by 1
for example if the array has the following {2 3 5}
after calling the function below it should change the array to {1 2 4}
void LL::decrement(int NewNum)
{
int id;
int temp;
PCB *x = front;
if(x->id != 1)
{
while(x!= NULL) //while x still not NULL keep doing this
{
x->id = temp; // place current value of id into temporary
NewNum = temp - 1; // increments temporary and sets it equal to NewNum
x = x->next; // goes to the next value
}
}
}
but after i call it i just get {0 0 0 }
any help on how to fix this?