Exemplo n.º 1
0
int main(int argc, char **argv){

	// An initially empty list
	struct Node *list = NULL;

	/* Go through argv array, prepeding each string
	and its length (up to 5 characters) to the linked list */

	// LOOP THROUGH ARGV
	int i;
	for (i=1; i < argc; i++){
		list = prepend(list,argv[i]);
	}

	/* Print the list */
	

	printf("prepended: ");

	print(list);

	selectionsort(list, compareData, swapData);

	printf("\n");
	printf("   sorted: ");

	print(list);

	reverse(&list);

	printf("\n");
	printf(" reversed: ");

	print(list);

	printf("\n");

	/* Deallocate all nodes */
	deallocate_list(list);

	return 0;

} //end of main
Exemplo n.º 2
0
int main(void)
{
  Node *head = NULL;
  int sel;

  init_list(&head);

  while(1){
    sel=disp_menu();
    if(sel==0) break;
    switch(sel){
      case 1: add_employee(head); break;
      case 2: retrieve_employee(head); break;
      case 3: remove_employee(head); break;
      default: break;
    }
  }
  deallocate_list(head);

  system("pause");
  return 0;
}