I want to check how this p?p->next:0 works. Its not the same operator as in java? Replacement, one liner for "if"?
e.g.
x = (5>6)? 10 : 4 ; //should assign x =4
struct node
{
int value;
struct node *next;
};
void rearrange(struct node *list)
{
struct node *p, * q;
int temp;
if ((!list) || !list->next)
return;
p = list;
q = list->next;
while(q)
{
temp = p->value;
p->value = q->value;
q->value = temp;
p = q->next;
q = p?p->next:0;
}
}
//int main