I am wandering when I am trying to read two times the files of the same folder, it will be stored with the same order or every time I ll read in folder it ll return different file order?
The order is not defined. However, as it happens, file systems tend to return things in the same order, but it won't be if the directory was restored from a backup for example.
Mounted partiions? I dunno what happens there. But as members of a union can change etc.
You aren't checking the dirent type in your code. You'll need to if you want to identify symlinks, directories etc.