/* getanumber.c Jeff Ondich, sometime in the 90's Updated 10 May 2023 Trivial program to help exectest.c illustrate exec and wait. Right after you run this program, try running "echo $?" at the bash prompt. */ #include #include #include #include int main() { int k = -1; pid_t process_id = getpid(); printf("\nGo ahead, enter a number: "); if (scanf("%d", &k) != 1) { printf("That wasn't a number!\n"); } printf("Process %d is shuffling off this mortal coil with status %d. Adieu.\n\n", process_id, k); exit(k); }