Question: Compile and run the following two programs: 1.c and 1_NULL.c Why does the second program crash? fix the problem in the 1_NULL.c program by modifying


Compile and run the following two programs: 1.c and 1_NULL.c
Why does the second program crash?
fix the problem in the 1_NULL.c program by modifying the 1 function such that whenever NULL value is used as its first argument during the function call from main function, this function displays a meaningful error message and the program
exits normally.
Tip:
To exit a program, you may use the exit() function. It takes an integer (zero or non-zero) to represent
different exit status. You must include the
- Exit Success is indicated by exit(0) statement which means successful termination of the
program, i.e., program has been executed without any error or interrupt.
- Exit Failure is indicated by exit(1) which means the abnormal termination of the program, i.e.,
some error or interrupt has occurred. We can use different integer other than 1 to indicate
different types of errors. For this program, you may use the exit(1); statement. Because you want to terminate the program due to null pointer error. Make sure that the NULL argument is used as instructed above.
7/|(this 1.c) #include
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
