title: How do I give a choice based on a specific choice for my program?
body: <p>In my program,I plan to filter choices for the users to get a specific piece of data for the inventory.
  For instance,at start of the program, there will be menu that gives user option to add or delete data and then for instance if they say insert then I will give them option to select a car company(i.e. like Toyota or Honda) and once they select that company I will give them choice of all Toyota models they can add in the inventory.This will happen so I can narrow down and do a selected operation on the information I have been given.</p>
  
  <p>The thing is I don't know how to filter out the models for a specific company.I have created different arrays containing different models but I don't know how to display user option of models for that company.</p>
  
  <p>Here is my code..</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  #define MAX_WORD_LENGTH 20
  
  #define MAX_SIZE 100
  typedef struct cardata{
  
      char carname[MAX_WORD_LENGTH];
      char carmodel[MAX_WORD_LENGTH];
      char caryear[MAX_WORD_LENGTH];
      char cartype[MAX_WORD_LENGTH];
      int  quantity;
  
  }CarData;
  
  
  struct node{
  
      CarData data;
      struct node *next;
      struct node *prev;
  }*start=NULL;
  
  const char *companyList[10] = {"Toyota", "Honda","Hyundai","Nissan","Mitsubishi","VoksWagon","Acura","Ford","Dodge","GMC"};
  const char *companyModels[10] = {toyotaModels,hondamodels,hyundaimodels,nissanmodels,mitsubishimodels,vokswagonmodels,acuramodels,fordmodels,dodgemodels,gmcmodels};
  const char *toyotaModels[10]={"Corolla","Camery"}
  const char *hondaModels[10]={"Civic","Accord"};
  
  
  void insert_first(){
      struct node *ptr;
  
      char carname[MAX_WORD_LENGTH];
      char carmodel[MAX_WORD_LENGTH];
      char caryear[MAX_WORD_LENGTH];
      char cartype[MAX_WORD_LENGTH];
      int  carQuantity;
      int ch;
  
      printf("\n\n\n1.Toyota \n2.Honda \n3.Hyundai \n4.Nissan \n5.Mitsubishi \n6.Volksvagon \n7.Acura \n8.Ford \n9.Dodge \n10.GMC\n");
      printf("\nPress a number to select corresponding car(i.e. 1 for toyota, 2 for honda): ");
      scanf("%d", &amp;ch);
      strcpy(carname,companyList[ch-1]);
      printf("\n\nEnter the car model: ");
      scanf("%s", carmodel);
      printf("\n\nEnter the car year: ");
      scanf("%s", caryear);
      printf("\n\nEnter the car type: ");
      scanf("%s", cartype);
      printf("\n\nEnter the  quantity of models: ");
      scanf("%d", &amp;carQuantity);
  
  
      if(start==NULL){
  
          start=(struct node *)malloc(sizeof(struct node));
          strcpy(start-&gt;data.carname,carname);
          strcpy(start-&gt;data.carmodel,carmodel);
          strcpy(start-&gt;data.caryear,caryear);
          strcpy(start-&gt;data.cartype,cartype);
          start-&gt;data.quantity=carQuantity;
          start-&gt;prev=NULL;
          start-&gt;next=NULL;
  
      }else{
  
          ptr=start;
          start=(struct node *)malloc(sizeof(struct node));
          strcpy(start-&gt;data.carname,carname);
          strcpy(start-&gt;data.carmodel,carmodel);
          strcpy(start-&gt;data.caryear,caryear);
          strcpy(start-&gt;data.cartype,cartype);
          start-&gt;data.quantity=carQuantity;
          start-&gt;next=ptr;
  
      }
  
  }
  
  void delete_first(){
  
      struct node *ptr;
      char carname[MAX_WORD_LENGTH];
      char carmodel[MAX_WORD_LENGTH];
      char caryear[MAX_WORD_LENGTH];
      char cartype[MAX_WORD_LENGTH];
      char modelNumber[MAX_WORD_LENGTH];
      int  carQuantity;
  
      if(start==NULL){
          printf("\n\nLinked list is empty.\n");
      }else{
          ptr=start;
          printf("\nThe car for which the entry is removed is %s \n",ptr-&gt;data.carname);
          strcpy(start-&gt;data.carname,carname);
          strcpy(start-&gt;data.carmodel,carmodel);
          strcpy(start-&gt;data.caryear,caryear);
          strcpy(start-&gt;data.cartype,cartype);
          start-&gt;data.quantity=carQuantity;
          start=start-&gt;next;
          free(ptr);
      }
  }
  
  void display()
  {
      struct node *ptr=start;
      int i=1;
  
      if(ptr == NULL){
          printf("\nLinklist is empty.\n");
      }else{
          printf("\nSr. No   Make     Model    Year   Type  Quantity\n");
          while(ptr != NULL){
              printf("\n%d.\t%s   %s   %s   %s   %d\n", i,ptr-&gt;data.carname,ptr-&gt;data.carmodel,ptr-&gt;data.caryear,ptr-&gt;data.cartype,ptr-&gt;data.quantity);
              ptr = ptr-&gt;next;
              i++;
          }
  
      }
  }
  
  int main(void)
  {
      int ch;
      do 
      {
          printf("\n\n\n1. Insert \n2. Delete \n3. Display \n4. Exit\n");
          printf("\nEnter your choice: ");
          scanf("%d", &amp;ch);
  
          switch(ch)
          {
  
              case 1:
                  insert_first();
                  break;
              case 2:
                  delete_first();
                  break;  
              case 3:
                  display();
                  break;
              case 4:
                  exit(0);                                            
              default:
                  printf("\n\nInvalid choice. Please try again. \n");
  
          }
  
      } while(1);
  
  
      return 0;
  }
  </code></pre>