Make a copy of the program arrayParams.c in /afs/cats/courses/cmps012a-cm/lab16. Modify that program to have a function that prints the contents of the array (instead of just doing the printing right in main). That is, main should be:
... fillIt(smallArray); printIt(smallArray); return 0;Submit this program under Submit Programs/Labs in WebCT.
Write a C program that repeatedly reads pairs of vectors of integers from standard input (the console/keyboard) and prints the sum of the two vectors. Each vector pair will be preceeded by the length of the two vectors (the two vectors must be the same length - you do not need to check this). The program ends when it reads in a vector length of 0. Ideally program would include a function that is called to read in a vector. The prototype or signature of the function should be:
void readVector(int vec[], int size);Notice this is almost like fillIt() from arrayParams.c but with the additional size parameter. You can assume that the vectors will never be longer than 100 elements.
Here is a sample execution. The lines in bold are the computer output, the other lines are the user input. Notice the program does not generate a prompt.
os-prompt>vectorAdd
5
5 4 1 3 3
2 10 0 -2 100
7 14 1 1 103
10
100 101 102 103 104 200 210 220 230 500
2 2 2 2 2 -1 -1 -1 100 -5
102 103 104 105 106 199 209 219 330 495
0
os-prompt>
If you get this program working, submit it also using WebCT.
I strongly suggest you first try and get this program working assuming that there will be only three lines of input: the size, the first vector, and the second vector. That will get you 2 of the 3 points for this part of the lab. When that it working, it should be easy to add a while loop that does the same thing until a 0 size is read. Although only a small number of points are associated with this more difficult part, mastering this will greatly increase your chances of doing well on the next in lab quiz which will test your use of arrays in C.