Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Write a C statement for each of the following. (4 pts) a. Declare an integer

ID: 3806512 • Letter: 1

Question

1. Write a C statement for each of the following. (4 pts) a. Declare an integer called total, initialize it to 10 b. Declare a pointer to an int called ptr and set it to point to total c. Set the value of total to 20 using ptr d. Print the memory address of total using total e. Print the memory address of total using ptr f. Create a new pointer qtr and let it point to total using ptr g. Make qtr point to integer result (assume already result declared) h. Double the value of result using qtr 2. Write a statement to: (1.5 pts) a. Assign character 'Z' to the variable pointed to by char pointer answer b. Change the value of variable pointed to by char pointer choice to next character c. Print the value of char pointer answer 3. Consider the following program with only the variable declarations shown. For each statement, specify if it is true or false. (2.5 pts) int xi void alpha (int a)( int b void beta() static int k; void gamma (int x) int main() int x, y, z; int y, z

Explanation / Answer

1.
a. int total=10;
b. int *ptr=total;
c. *ptr=20;
total =*ptr;
d. printf("Address of total variable: %x ", &total);
e. printf("Address of total variable: %x ", ptr );
f.int *qtr;
qtr = ptr;
g.*qtr = result;


3.
a. true
b. false
c. true
d. false
e. false

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote