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

  • SEARCH
  • Home
  • 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 4569986
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:17:50+00:00 2026-05-21T19:17:50+00:00

i checked and didnt find any material which can help me so i had

  • 0

i checked and didnt find any material which can help me so i had to ask. this is the code:

list.h:

typedef struct List_t *List;

list.c:

#include "list.h"
#include <stdlib.h>
#include <stdio.h>


typedef struct Item_t
{
    struct Item_t* next;
    ListElement data;
}*Item;

typedef struct List_t
{
    Item head;
    Item iterator;
    CopyListElement copyFunc;
    FreeListElement freeFunc;
};

list_example_test.c:

#include "list.h"
#include <stdlib.h>
#include <stdio.h>
ListElement copyA(ListElement a)
{
    return a;
}
void destroyA(ListElement a)
{
}
bool testListCreate();
bool testListCopy()
{
    List list1=listCreate(copyA,destroyA);
    listInsertFirst(list1,(void*)6);
    listInsertFirst(list1,(void*)2);
    listInsertFirst(list1,(void*)1);
    List list2=listCopy(list1);
    listClear(list1);
    if(list2->head==NULL) //here is the error!!
    {
        return false;
    }
    return true;
}

the last piece of code is supposed to check whether the listCopy() function works. the compiler recognizes the name List and when i type “list2->” it even suggests to autocomplete with the fields of List(in this instance i chose “list2->head”.
what is causing the problem and how to fix it? thanks!

  • 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-05-21T19:17:51+00:00Added an answer on May 21, 2026 at 7:17 pm

    List_t is an incomplete type as far as list_example_test.c is concerned. This is actually a common idiom in C for encapsulating data. There should be functions defined somewhere to allow you to manipulate items of type List_t without directly accessing the internals of the list. You’ll probably find you have something like listNext(List_t) or listIterate(List_t) defined somewhere. Look in the same file as where listCopy() is declared.

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

Sidebar

Related Questions

i tried to find any helpful post for my problem, but didn't find so
I'm trying to find comment blocks in PHP source code using regular expressions in
I checked out a project from SVN and did not specify the project type,
I checked out a copy of a C++ application from SourceForge (HoboCopy, if you're
I've removed a checked in file from the CVS branch, i.e.: cvs remove -f
How to get the checked option in a group of radio inputs with JavaScript?
I have checked with the wikipedia article , and it seems like it is
I have a folder checked out using TortoiseSVN. If I copy a newer version
Let's say I checked in a changelist (in Perforce) with lots of files and
I have checked in a huge Eclipse project from my desktop computer to the

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.