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 8368757
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:27:45+00:00 2026-06-09T13:27:45+00:00

i dont know why the list returned is NULL , this is the code:

  • 0

i dont know why the list returned is NULL, this is the code:

In my List.h

struct nodo_ {
    char* dato;

    struct nodo_ *next;
};
struct nodo_ *Lista;
/*Def list */
void createList(struct nodo_ **Lista);

in my main.c

struct nodo_ *Lista;

int main(){
    createList(Lista);
    while(Lista != NULL){        
         printf("The date is %s\n  ",Lista->dato); //Error here now
         Lisa = Lista->next;
    }

    return 0 ;
}

in my List.c im create the List :

void createList(struct nodo_ *Lista){
    struct nodo_ *Aux_List = list_D;
    aux_List = malloc(sizeof(struct nodo_));

    char* path_a = "Hello"; 
    char* path_B = "Minasan";

    /* Store */
    aux_List->dato = path_a;
    aux_List = Aux_List->next;    
    aux_List = malloc(sizeof(struct nodo_));
    aux_List->dato = path_b;
    aux_List->next = NULL;

}

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-06-09T13:27:46+00:00Added an answer on June 9, 2026 at 1:27 pm

    That pointer is being passed by value, i.e., a copy is made. If you wish to initialize the pointer to a completely new value then you must use another level of indirection (i.e., a nodo_**).

    On a side note, typedefing pointer types is almost always a bad idea unless the type is truly opaque (which yours is not). One reason for this “rule” is evident when you consider another bug in your code:

    auxList = (Lista*)malloc(sizeof(Lista));
    

    You’re allocating space for a pointer to noda_, not enough for a noda_ object. Also, don’t cast the return value of malloc in C. It is redundant as a void* is safely and implicitly converted to any other pointer type and, if you forget to include stdlib.h, malloc will be assumed to be a function which returns int, and the cast hides the error. (only applies to compilers which implement C89 or an older version)

    EDIT:

    To initialize a pointer argument within a function:

    void init(struct node **n) {
        if(n)
            *n = malloc(sizeof(struct node));
    }
    
    int main() {
        struct node *n;
        init(&n);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't know if this feature that shows list of pages that user has
I dont know if this is possible. In SSIS Derived column transformation, can you
I dont know where my error is in this mysql query $sql = INSERT
I have list item with EditText in it, I dont know how many items
I have a code that fetches a list from DB. Using that returned array
I don't know how to bind a List of Drink to a WPF TreeView.
I know how to make the list of the Fibonacci numbers, but i don't
I dont know how to debug structures like: fun1 <- function(obj){ a<-c(obj,4) c(a,5) }
I dont know how many values will be present from Cell A1 to A65555.
I dont know what happend but I cant register any dlls anymore. It seems

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.