Ejemplo n.º 1
0
int		ft_readline_p5(t_lst *****lsta, t_lst ****lstb, char *line)
{
	if (ft_strcmp(line, "ss") == 0)
	{
		if (****lsta && ft_comptelem(****lsta) > 1)
			swap5(&lsta);
		if (***lstb && ft_comptelem(***lstb) > 1)
			swap3(&lstb);
		return (1);
	}
	else if (ft_strcmp(line, "rr") == 0)
	{
		if (****lsta && ft_comptelem(****lsta) > 1)
			rotate5(&lsta);
		if (***lstb && ft_comptelem(***lstb) > 1)
			rotate3(&lstb);
		return (1);
	}
	return (0);
}
Ejemplo n.º 2
0
int main(void)
{
    int x = 42;
    int y = 17;
    int* xp = &x;
    int* yp = &y;
    
    printf("before swap: x=%d,y=%d\n",x,y);
    printf("before swap: *xp=%d,*yp=%d\n",*xp,*yp);
    printf("before swap: xp=0x%p,yp=0x%p\n",xp,yp);
    
    swap5(&xp, &yp);
    
    printf("after swap: x=%d,y=%d\n",x,y);
    printf("after swap: *xp=%d,*yp=%d\n",*xp,*yp);
    printf("after swap: xp=0x%p,yp=0x%p\n",xp,yp);
    
    assert(xp == &y);
    assert(yp == &x);
    assert(x == 42);
    assert(y == 17);

    return 0;
}