Question: C Programming // use stdio.h, stdlib.h, string.h and math.h only. Extend the following program to show the value and the location at which each variable

C Programming // use stdio.h, stdlib.h, string.h and math.h only.

Extend the following program to show the value and the location at which each variable is stored.

#include int main (void) { int a = 1, b = 2; int* ptr = &b; /* your code goes here */ return 0; }

Find out the correct format specifier to print a pointer.

Observe the values and locations, and answer the following questions.

1. What are the values of - a, b, ptr ?

2. What are the locations of - a, b, ptr (yes, the location of the pointer ptr) ?

3. Any of the locations are the same?

4. Any of the values are the same?

5. Explain the relationship between the value of ptr and the location of b.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!