예제 #1
0
파일: do_output.c 프로젝트: elominp/lem-in
void    do_output(t_tre *start, t_lid *lemdata)
{
  t_mls *path_start;
  t_mls *path_end;
  t_tre *end_room;
  t_tre *tmp_list;


  if (start == NULL)
    return;
  if ((path_start = createlist(start, NULL)) == NULL)
    return;
  start->nb_ants = my_atoi(lemdata->file->next->item);
  tmp_list = start->parent;
  while (tmp_list != NULL)
    {
      if (tmp_list->parent == NULL)
	end_room = tmp_list;
      if (list_pushback(path_start, tmp_list, NULL) == MERROR)
	return;
      tmp_list = tmp_list->parent;
    }
  path_end = path_start;
  while (path_end->next != NULL)
    path_end = path_end->next;
  while (end_room->nb_ants < lemdata->nb_ants)
    ant_march(path_end);
}
예제 #2
0
파일: add-one.c 프로젝트: velentr/foundry.c
int main(int argc, char *argv[])
{
    struct list uut;
    struct list_elem e;

    list_init(&uut);
    list_pushback(&uut, &e);

    assert(!list_isempty(&uut));
    assert(list_head(&uut) == &e);
    assert(list_tail(&uut) == &e);
    assert(list_popback(&uut) == &e);

    return 0;
}
예제 #3
0
int main(){

	list *linkedList = list_new();
	int temp;
	

	int i;
	for(i = 0; i < 3; i++){
		printf("Enter number: \n");
		scanf("%i", &temp);
		list_pushback(linkedList, temp);
		//printf("%d\n", x[i]);
	}
	
	//printf("test");
	list_write_out(linkedList);
	return 0;
}