The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 6 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
When I try to compile this code in gcc I am getting multiple errors. Could somebody look at my code and tell me why? I've attached the .c files as well as the screenshot of my error.
Â
/***************************************************
Name: main.c
version: 0.1
Description:Â Implementation of a double linked list
Change history:
0.1 Initial version
License: GNU GPL v3
Lab Problem #2 Objective:
1. Given that pHead is a global variable declared in
  DoubleLinkedList.c - rewrite all the functions that
  use pHead to accept a passed parameter that points
  to the head of the doubly-linked list used in the
  code examples in the following modules:
   a. DoubleLinkedList.c
   b. DoubleLinkedList.h
   c. doubleMain.c (if necessary)
   d. doubleMain.h (if necessary)
Lab Problem #2 Suggestions:
1. Make sure the four modules listed in items 1a thru 1d
  above are in the SAME directory.
2. Compile with the command:
  gcc DoubleLinkedList.c doubleMain.c -o doubleListX
3. Test with a few simple steps.
4. Start working on the objective 1 above by editing the
  appropriate modules.
****************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "doubleMain.h"
int main(void)
{
   int choice =0;
   int InputNumber=0;
   DoubleLinkedList* pHead = NULL;
   printf("\nThis program creates a double linked list");
   printf("\nYou can add nodes in forward and reverse directions");
   do
   {
       printf("\n1.Create Node Forward");
       printf("\n2.Create Node Reverse");
       printf("\n3.Delete Node");
       printf("\n4.Display Nodes in forward direction");
       printf("\n5.Display Nodes in reverse direction");
       printf("\n6.Reverse nodes");
       printf("\n7.Sort nodes");
       printf("\n8.Exit\n");
       printf("\nEnter your choice: ");
      Â
       scanf("%d",&choice);
       switch(choice)
       {
             case 1:
             pHead = AddNodeForward(pHead);
             break;
             case 2:
             pHead = AddNodeReverse(pHead);
             break;
             case 3:
             printf("\nEnter the node you want to delete: ");
             scanf("%d",&InputNumber);
             pHead = DeleteNode(pHead,InputNumber);
             break;
             case 4:
             printf("\nDisplaying node data in forward direction \n");
             DisplayNodeForward(pHead);
             break;
             case 5:
             printf("\nDisplaying node data in reverse direction\n");
             DisplayNodeReverse(pHead);
             break;
             case 6:
             pHead = ReverseNodes(pHead);
             break;
        Â
          case 7:
          pHead = SortNodes(pHead);
          break;
             case 8:
             printf("Exiting program");
             break;
        Â
             default:
             printf("\nIncorrect choice\n");
        }
   } while (choice !=8);
   return 0;
}
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly