Strore getcwd on a struct on a function :    

         typedef struct
           {
             char Path[100];
           }DirectoryInformation;
    
          void Getskelutofdirectorie(char *dir, int lvl)
          {
            DirectoryInformation DI[100];
            char cwd[1024];
          
        //Search recursive
    
    //where i want to put the path on the struct to use on main
    
                getcwd(cwd,sizeof(cwd));
                strcpy(DI[0].Path, cwd);
           }
          
     int main(void)
     {
       DirecoryInformation DI[100];

     printf("%s", DI[0].Path);  
  
     }

I can print the path but if i use on main function will work.
can somebody help me out?
Is execute with out error but when i print out make segmentation fault




