Indeed it is a bug because it is not expected to happen. By defining int stat_val
it is not initialized. It will have a random value. This is true. I am not very familiar with multi process of c. Maybe we must input the reference of int with vaue 0 to wait()
method.
It was introduced to bypass the occasional seg.fault: