Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q7. Programming assignment: You will write a C program (60-100 lines) that satisfies the following criteria. Please compile, run your program on one of gpel
Q7. Programming assignment: You will write a C program (60-100 lines) that satisfies the following criteria. Please compile, run your program on one of gpel machines, and attach a screen shot of the execution result (40 points). - REMINDER: If your code cannot be compiled, you will get 0 point. - This assignment covers the basic C coding techniques. (Hint: please do not forget to include corresponding header files.) - [Arrays and pointers] Declare two integer arrays with the same size using pointers and dynamic memory allocation. The size should be determined by a user's input. - [Pointer] Print the address of the first array. - [Address space] Try the operator sizeof and print size of the first array pointer. Compare with the above one and think about the reason. - [Loop and array] Use the array size provided by the user and assign an integer value to the array's element. Again, each integer value must be provided by the user. Repeat the procedure to fill both arrays we declared. - [Declaring a function] Declare a function with two integer parameters, which calculates and returns the multiple of the two numbers. - [Calculation, condition statements, and file write] Using the function we declared, multiply i-th element of the first array by i-th element of the second array. For each result, check if the multiplication result is an even or odd number using condition statements. Declare a file pointer and write the multiplication results in the new file named "hw1_output.txt". Once the file write is done, do not forget to close the file. - [File read] Open "hw1_output.txt" file in your program, read, and print the content of the file. Again, please close the file
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started