Question: Please be in programming language C. Thanks! Write a C program to work on pointers. In main ) you will first .Declare five integer variables

 Please be in programming language C. Thanks! Write a C program

to work on pointers. In main ) you will first .Declare five

Please be in programming language C. Thanks!

Write a C program to work on pointers. In main ) you will first .Declare five integer variables named as a, b, c, temp, sum and set the initial values for a, b, c, as 10, 20, 30, respectively .Declare three integer pointers named as pa, pb, pc. These pointers should initially hold the addresses of variables a, b, c, respectively Declare three inte pointers should initially hold the addresses of pointers pa, pb, . These pointers to pc, respectively ger pointers to pointers as ppa, ppb, ppc .If needed for the below tasks, you can declare other variables as well as pointers later Now implement the following tasks in the main (O Write the necessary statements to print the values of a, b, c by just using a, pb, ppc Write the necessary statements to find the sum of the values in a, b, c by just using a, pb, ppc, sum. Then print sum Write the necessary statements to exchange/print the values in a and b, by just using pa, ppb and maybe temp. Then print a and b Write the necessary statements to exchange the values/addresses in pa and pb by just using pa, ppb and maybe a temp pointer that you can declare. Then print the values of a and b by directly using a and b as wells as indirectly by using *pa and *pb. Explain what happens here, why the values of a and b did not change when we access them directly while it seems they changed when we access them indirectly. Type your explanation as a C comment in your program after the printf statements. o (direct, indirect, indirect indirect access) o o o Now copy/paste the following functions before your main() void increaseA (int val val++; void increaseB (int *pval) pval++; void increaseC (int *pval) pval++: void increaseD (int pval) (*pval)+ . Then call each of these functions in main) as follows increaseA (a) increaseB (&a); increaseC (&a); increaseD (&a) and print the value of a after each call to see what happens. Accordingly, explain why the first three call did not cause any change on variable a while the last one increases it by 1. Type your explanation as a C comment next to the above calls in your program

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!