Question: #include Following C code contains runtime error. a. Identify the error and explain it in comments. b. Provide a solution to fix it. int
#include Following C code contains runtime error. a. Identify the error and explain it in comments. b. Provide a solution to fix it. int *pointer (void); void main() { int *ptr; // declare pointer variable ptr ptr pointer (); // assign pointer () return value to ptr 42; // dereference ptr and change value to 42 printf("%d", *ptr); // display pointer value *ptr } } = = int *pointer () { int temp; return (&temp); // declare pointer () function // return the address of the local variable
Step by Step Solution
3.53 Rating (150 Votes )
There are 3 Steps involved in it
Lets analyze the provided C code and identify the runtime error and then provide a solution to fix i... View full answer
Get step-by-step solutions from verified subject matter experts
