title: Is this C implementation a linked list?
body: <p>I'm a Java dev and I'm learning C. I'm working on a project, it's the implementation of tree command from linux in C and I have a simple question. Is this t_node a linked list? It looks like a linked list for me.</p>
  <p>This is a part of the code:</p>
  <pre><code>struct t_node {
          char* name;
          int  ptd;
          struct t_node *next_dfile;
          struct t_node *next_file;
  };
  
  static struct t_node* create_tree(char *root_name) {
          DIR *dir = opendir(root_name);
          struct dirent *dr = {NULL};
          struct t_node *ptr_tstart = NULL,*temp = NULL,*temp1 = NULL;
  
          char *name = (char *)calloc(2000, sizeof(char));
  
          if (dir == NULL) {
                  printf(&quot;\nFailed to open ..!!&quot;);
                  printf(&quot; : %s&quot;, root_name);
                  return NULL;
          }
  
          while ((dr = readdir(dir)) != NULL) {
                  if (strcmp((dr-&gt;d_name), &quot;.&quot;) != 0 &amp;&amp; strcmp((dr-&gt;d_name), &quot;..&quot;) != 0) {
                          temp = create_tnode(dr-&gt;d_name);
                  } else {
                          temp = NULL;
                          continue;
                  }
  
                  if (temp1 != NULL) {
                          temp1-&gt;next_file = temp;
                  } else {
                          (ptr_tstart) = temp;
                  }
  
                  if ((dr-&gt;d_type) == DT_DIR) {
                          temp-&gt;ptd = TRUE;
                          strcpy(name, root_name);
                          (temp-&gt;next_dfile) = create_tree((strcat((strcat(name, &quot;/&quot;)), dr-&gt;d_name)));
                          strcpy(name, root_name);
                  } else {
                          (temp)-&gt;ptd = FALSE;
                          (temp)-&gt;next_dfile = NULL;
                  }
                  temp1 = temp;
          }
          return (ptr_tstart);
  }
  
  
  static struct t_node* create_tnode(char* n) {
          struct t_node *temp = (struct t_node *)malloc(sizeof(struct t_node));
  
          temp-&gt;name = n;
          temp-&gt;next_dfile = NULL;
          temp-&gt;next_file = NULL;
  
          return temp;
  }
  </code></pre>
  <p>t_node will be a file or directory, if ptd is true then it is a directory. next_file will be the next file/directory in the same directory and next_dfile will be the next file/folder inside a directory.</p>
  <p>We have music_dir with rock and disco files and movie_dir with drama and thriller files. mudic_dir will have movie_dir as next_file. And music_dir will have rock as next_dfile, and rock will have disco as next_file, etc.</p>
  <p>I just want to know if this t_node is a linked list. Thank you!</p>