Question: pointer1.c Type the following C program. Save as pointerl.c. Compile and run the program. Use gdb (a debugger for c) to trace the program so

 pointer1.c Type the following C program. Save as pointerl.c. Compile and
run the program. Use gdb (a debugger for c) to trace the
program so you can answer the questions listed below. GDB Tutorial. 1)

pointer1.c Type the following C program. Save as pointerl.c. Compile and run the program. Use gdb (a debugger for c) to trace the program so you can answer the questions listed below. GDB Tutorial. 1) Add header comments to the program as shown in the Documentation and Style Requirements 2) Add comments to the top of the program to answer the following questions: A) What does the program do? B) What type is the formal parameter to the mysteryl function? c) What type is the actual parameter to the mysteryl function? D) What role does the *s play in the for loop? #include int mysteryl (char *s) int i for (1-0 ; *s; i++, s++); /* empty body */ return i; ) // end function mysteryl int main (void) printf ("%d ", mystery! ( "asdx ddf gf")); ) I/ end function main 3) Add const to the function parameter (to the data type, the pointer, or both) so that the function satisfies the principle of least privilege. [It is recommended that you test the program with the most restricted parameter type first, then add privileges as needed.1 pointer2.c Enter the following C program. Save it as pointer2.c. Compile and run the program. Use gdb (a debugger for C) to trace the program so you can answer the questions listed below. GDB Tutorial. 4) Add header comments to the program as shown in the Documentation and Style Requirements. 5) Add comments to the top of the program to answer the following questions: A) What does the program do? B) After the line char s[6]. "ab x", what values are in the 6 elements of the s array? c) What causes the for loop to terminate? D) What is the output of the program? #include void mystery2 (char *s) char *t for (test st+) ) // end function mystery2 int main (void) t char s [6] "ab x"; printf("%s ", s); mystery2(s): printf("%s ", s); ) 1/ end function main 6) Add const to the function parameter (to the data type, the pointer, or both) so that the function satisfies the principle of least privilege. It is recommended that you test the program with the most restricted parameter type first, then add privileges as needed. pointer3.c 7) Write a program that has 2 functions and a main (explained below). Save it as pointer3.c Add header comments to the program as shown in the Documentation and Style Requirements. 8) Place the function prototypes above the main and the function implementations below the main function (in the same file). The following are descriptions of the two functions: I. int input (int *a, int *b, int *c) This function should attempt to input 3 integers from the keyboard and store them in the memory locations pointed to by a, b, and c. The input may not be successful in reading all three values. (See "Checking for end of input in C"). The function should return the number of values that were successfully read. II. int sumsort (int *a, int *b, int c) This function should arrange the 3 values in the memory locations pointed to by a, b, and c in ascending order and also return the sum of the contents of the memory locations a, b, and c. 9) The main function should do the following: while eof has not been reached call input if 3 values were successfully read print the 3 values call sumsort and store the returned value in a separate variable print the 3 integers in ascending order folloved by the sum end while

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!