Автор работы: Пользователь скрыл имя, 22 Октября 2010 в 13:05, Не определен
Лабораторная работа
15 
/*
struct list
{
int value;
struct list *next;
};
list *hear=NULL;
int count=0; 
//void show 
void show(struct cell *p)
{
if (p==NULL)
{
printf("\nEND");
return;
}
      printf("\nadress=%p\
output(p->pc);
} 
 
 
void add_head (long value)
{
count++;
list *old_head=head;
head=(struct list *)malloc(sizeof(struct list));
head->next=old_old_head;
head->value=value;
} 
 
void insert (int pos,long value)
{
list *target;
list *old_next;
int i=0;
if(head!=NULL)
{
target=head;
            while((i<pos)&&(
{
                  target=
i++;
}
if(i!=pos) return;
            old_next=target->
            target=target->
            target->value=
            target->next=old_
count+;
}
else
{
            target=head=(
target->next=NULL;
            target->value=
count+;
}
} 
 
void delete_any (int pos)
{
if(pos<0) return;
list *previous;
int i=0;
if(head!=NULL)
{
if(pos==0)
{
list *next_item=head->next;
free(head);
                  head=next_
}
else
{
                  previous=
pos--;
                  while((i<
{
                        previo
i++;
}
if(i!=pos) return;
                  list *next_item=previous->next->
                  free(
                  previous->
}
}
*/ 
 
16
Информация о работе Программирование на языках высокого уровня