Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8634753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:47:57+00:00 2026-06-12T09:47:57+00:00

I am trying to create a doubly linked list for a homework. I’m using

  • 0

I am trying to create a doubly linked list for a homework. I’m using the book mastering algorithms with C by Kyle Louden as a guideline. The book states that i need to initialize a doubly linked list before I use it which I’m trying to do but when I enter my code visual studios tells me “incomplete type not allowed for the following line “void dlist_init(Dlist *list, void (*destroy)(void *data)){}”, it also states that Dlist is undefined but from what I understood that wasn’t a variable to be defined. I am very new to this so i might be completely wrong. please let me know any problems you see. the full code is as follows :

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "bool.h"
#include "dlinklist.h"
#include "DlistElmt.h"
#include "Dlist.h"
#include "dlistdata.h"

/**************************************************************************************************/

int main(int argc, char* argv[])
{
    FILE* ifp, *ofp;
    //char outputFilename[] = argv[2];
    int hour, min;
    int* list;
    float temp;

    if(argc != 3)    /* argc should be 3 for correct execution */
    {
        /* We print argv[0] assuming it is the program name */
        printf("usage: %s filename", argv[0]);
    }
    else
    {
        // We assume argv[1] is a filename to open
        ifp = fopen(argv[1], "r");

        if(ifp == 0)
        {

            printf("Could not open file\n");
        }

        else
        {

            ofp = fopen(argv[2], "w");
        }
    }
}

void dlist_init(Dlist* list, void (*destroy)(void* data))
{

    list->size = 0;
    list->destroy = destroy;
    list->head = NULL;
    list->tail = NULL;

    return;

}

I also have the following headers:

dlinklist.h

/**************************************************************************************************/

#ifndef DLIST_H
#define DLIST_H

#include <stdlib.h>
#include "DlistElmt.h"
#include "Dlist.h"
#include "Dlistdata.h"


/**************************************************************************************************/

#endif

Dlist.h

/**************************************************************************************************/

#ifndef DLIST_H
#define DLIST_H

#include <stdlib.h>
#include "dlinklist.h"
#include "DlistElmt.h"
#include "Dlistdata.h"


/**************************************************************************************************/

typedef struct Dlist_ {

int size;

int (*match)(const void *key1, const void *key2);
void (*destroy)(void *data);

DlistElmt *head;
DlistElmt *tail;

} Dlist;


#endi

dlistdata.h

/**************************************************************************************************/

#ifndef DLISTDATA_H;
#define DLISTDATA_H;

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "dlinklist.h"
#include "DlistElmt.h"
#include "Dlist.h"


/**************************************************************************************************/

void dlist_init(Dlist *list, void (*destroy)(void *data));

#endif

DlistElmt.h

/**************************************************************************************************/

#ifndef DLISTELMT_H
#define DLISTELMT_H

#include <stdlib.h>
#include "dlinklist.h"
#include "Dlist.h"
#include "Dlistdata.h"


/**************************************************************************************************/

typedef struct DlistElmt_ {

void *data;
struct DlistElmt_ *prev;
struct DlistElmt_ *next;

} DlistElmt;

/**************************************************************************************************/

#endif
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:47:59+00:00Added an answer on June 12, 2026 at 9:47 am

    You’ve got a recursive mess going on in your header files.

    1. Your main file only needs #include "dlinklist.h". That header includes the others.
    2. dlinklist.h has the wrong include guard names. DLINKLIST_H not DLIST_H.
    3. dlistelmt.h needs no include lines at all.
    4. dlist.h only needs #include "dlistelmt.h" since it uses it in its declarations.
    5. dlistdata.h only needs `#include “dlist.h” since it uses it in its declarations.

    Your posted main file was missing some curly braces and formatting. I just edited your question to fix it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a bubble sort on a doubly linked linked list
I was trying to create a linked list with structs. The idea is to
I am trying to use a custom data type in a doubly linked list.
I'm trying to create a list nested within a list using XHTML Strict 1.0.
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
Ok so I am trying create a login script, here I am using PHP5
I am trying to create double and number format cells in excel using NPOI
I am trying to create a multi-dimensional NetCDF file using the R package ncdf
I am trying to create Guava TreeMultimap object in scala, using TreeMultimap.create method, but
I'm trying to create a list as below in Java. Maybe I'm naive to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.