A file descriptor is a small non-negative integer that a process uses to name a file it has opened; it indexes the process’s descriptor table, kept by the kernel. Each entry points to an open file description, a kernel object created by each successful open, which records the file, the access mode, and the file offset: the position where the next read or write starts. By convention descriptors 0, 1 and 2 are the standard input, output and error.
offsets.c: descriptors 3 and 5 share one description, and so one offset; descriptor 4 has its own. Both descriptions lead to the same file.