Question: how to do it with C program Description: This prelab is on pointers. Only pointers should be used in the implementation If you use array
how to do it with C program
Description: This prelab is on pointers. Only pointers should be used in the implementation If you use array notation in your lab you will lose points! You have been warned Functions to be used int errorCheck(int)- takes in an integer and checks to see if it is between 1 and 10. If it is return 1, else return O void factorial(int output, int limit) - takes in a pointer to the beginning of an array of integers (the output variable) and a limit. You will calculate factorials from 1 up to and including the limit, and store each result in the output array. Sample output gives a good example void printArray (int *, int) - prints out the content of the array int main(): Like the previous labs and homework assignments first read the input size from the user, perform an error check to make sure the size of the input is between 1 and 10. Initialize integer pointer and call functions Notes 1. In the main declare an integer pointer and assign the address of this pointer to your initially created array 2. Use only pointer notation and pointer arithmetic to implement the assignment. Sample outputs: Characters in bold are input from the user [nalyv2@tc-m610-login-node623 lab8]S compile prelab8.c [nalyv2@tc-m610-login-node623 lab8]S /a.out Enter a value to calculate the factorial: 4 The array of the stored factorial values 1 2 6 24 [nalyv2@tc-m610-login-node623 lab8]S compile prelab8.c [nalyv2@tc-m610-login-node623 lab8]S /a.out Enter a value to calculate the factorial: -3 Input must be larger than 0 and less than 10. Please enter again: 6 The array of the stored factorial values 1 2 6 24 120 720
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
