title: storage size of DIR variable is not known
body: <p>The code of the faulty function is:</p>
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;fcntl.h&gt;
  #include &lt;sys/stat.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  #include &lt;dirent.h&gt;
  #define _ISDIR 1729
  #define _ISFILE 431
  #define _EXIST_ERR 611
  #define _BUF_LEN 512
  unsigned int fod(char*);
  unsigned int fod(char *name){
      DIR check_dir;
      check_dir=opendir(name);
      int openf=open(name,O_RDONLY);
      if(check_dir!=NULL){
          return _ISDIR;
      }
      if(openf!=-1){
          return _ISFILE;
      }
      return _EXIST_ERR;
  }
  </code></pre>
  <p>When I compile it with gcc 12.1.1, I get the following error:</p>
  <pre><code>copy.c:14:9: error: storage size of ‘check_dir’ isn’t known
     14 |     DIR check_dir;
        |         ^~~~~~~~~
  </code></pre>
  <p>How do I fix it? the function parameters are right, everyone says that this is how a directory should be opened. How do I fix it?</p>