1. Given the variable declarations below: char c, *cp; int n=2, a[100], *ip; explain whether the following expressions are legal or illegal. For those that are legal, what are their effect? (or what do they do?) cp = c; cp = &c; *cp = &c; cp = &a; &cp = c; &cp = &c; ip = &a; ip = a; ip = &a[0]; (ip = a) + n; *((ip=a)+n) = 5; 2. Using pointer to write a function that reads in an array of floating point numbers from the screen and return that array to the calling function. (you can assume that there is a maximal number of the numbers to be read in. You don't have to use dynamic memory allocation for this one.) 3. Consider the following variable declaration char a; const char b = `#`; const char * p1; char * p2; Explain whether the following statements are legal or not. If not, why. If yes, what does it do. p1 = &b; p1 = &a; p2 = &a; p2 = &b; *p1 = '$'; *p2 = '$'; p1 = p2; p2 = p1; 4. Consider the Binary_Search function that we discussed in the lecture (binary_search.c posted on 10-Apr-2007, in the handouts section), None of the following changes will keep the program correct 1) replace the variable initialization "right = n-1" by "right = n" 2) replace the while condition "left <= right" by "left < right" 3) replace the assignment "check = (left + right)/2" by "check = (left + righ t)/3" 4) replace the assignment "left = check + 1" by "left = check" For each of the above cases, give an example of array a[] in the main program and a value of variable x (the one needs to be searched in a[]) so the modified Binary_Search will fail. Name your answer hw4.2.txt, which is a file that contains only 1) a[] = { }, x = ? 2) a[] = { }, x = ? 3) a[] = { }, x = ? 4) a[] = { }, x = ? 5. Write a C program that asks user to enter a day of the week in the format of: Sun, Mon, Tues, Wednes, Thurs, Fri, or Satur. Your program should keep on printing the following message until a valid day of the week is entered: Enter a day of the week (Sun, Mon, Tues, Wednes, Thurs, Fri, or Satur): on a valid input, e.g. Mon, print out the following message: Today is Monday. Read in the input as a string and feel free to use functions in string.h 6. Write a C program that reads in four integers, a1, b1, a2, and b2. Print print out (a1 b1) (a2 b2) if a1 < a2, or a1 = a2 and b1 < b2 otherwise print out (a2 b2) (a1 b1) 7. Using pointer to write a program that reads in an array of integers from the screen and print out all of them, except the largest and the smallest, in the order that they are entered. Make sure that you allocate memory and free the memory at the end. For example, on input 3 2 -12 34 6 7576 30 -2000 0 9 9 123 433 77 211 34 545 65 210 300 your output should be 3 2 -12 34 6 30 0 9 9 123 433 77 211 34 545 65 210 300