The code that I will explain is available here.
Everything is copied (on write) to child on forking, hence, every process will have a different buffer! (but contents will be same as parent initially).
The program is create a child (C.1) from parent process (C), then, prints the info about the child. Again forking from C.1 which results into C.1.1 being created and then printing info about C.1.1. Finally a fork happens from C.1.1 resulting into C.1.1.1 (bad naming convention, IKR). Last print statement again prints information about each child and parent.