Write a C program that prompts the user for a positive integer n. The program then creates a dynamic array of n elements to store n values (can be positive/negative floating-point values) supplied by the user. The program finally prints out the pair of values having the maximum total. Note: Your program must use a pointer(s) for dynamic memory allocation and at least two local variables.
COSC 458/647 Quiz 01 One submission per group Name(s): ________________________________________________________________________ Submission instructions: + Q1: Only turn in your .c/.cpp source code. Do not turn in any other file format. + Q2: Include your gdb command(s) and screenshot(s) for each question in a PDF format. + Q3: Screenshot of your main() disassemble and details Answer the following questions. Q1. Write a C program that prompts the user for a positive integer n. The program then creates a dynamic array of n elements to store n values (can be positive/negative floating-point values) supplied by the user. The program finally prints out the pair of values having the maximum total. Note: Your program must use a pointer(s) for dynamic memory allocation and at least two local variables. Sample input/output: Enter n = 5 Enter 5 values: 12.1 -1.5 3.78 -9.63 11.52 The max. pair is (12.1 and 11.52) Q2. Set the appropriate break point(s), debug your program with gdb and print out (a) the address and content of the pointer and local variables before any loop. Which part of the program’s memory the pointer is pointing to (e.g., stack or heap) (b) same as part (a) but before the program exits. Q3. Disassembly the whole main() function and map the local variables to the assembly code .e.g, → ebp +– ??? → ebp +– ??? …