I am trying to understand how WEXITSTATUS(status) works. I have come across a piece of code where the return value of WEXITSTATUS(status) is being added to a variable.
Here is the snippet:
waitpid(-1, &status, 0);
counter += WEXITSTATUS(status);
How can the return value of WEXITSTATUS be calculated?