title: Understading where structure and its items are declared
body: <p>I have found a simple implementation of Unix's <code>ls</code> utility.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;sys/stat.h&gt;
  #include&lt;dirent.h&gt;
  
  int main(int argc, char *argv[])
  {
      DIR *dp;
      struct dirent *sd;
      dp = opendir(argv[1]);
      while ((sd = readdir(dp)) != NULL) {
          printf("%s\n", sd-&gt;d_name);
      }
      closedir(dp);
  }
  </code></pre>
  
  <p>The main question I have is how <code>d_name</code> item from the structure is created or where is it located? Is it built-in part of <code>dirent.h</code> ? </p>
  
  <p>I know that typically, structure would be created with prototype like this:</p>
  
  <pre><code>struct myStructure {
  int number;
  char name[10];
  }
  </code></pre>
  
  <p>And a new variable of that type would be <code>struct myStructure Variable</code>.</p>
  
  <p>But in this code I just see <code>struct dirent *sd</code> which is pointer to <code>dirent</code> structure, if not mistaken, so where is that structure is prototyped ?</p>