1. cp = c; illegal, must assign an address to cp cp = &c; legal, assign variable c's address to cp *cp = &c; illegal, cannot copy/store the address to where cp points to cp = &a; illegal, a's address is the address of a[0], &a does not make any sense. cp is also a char pointer &cp = c; illegal, cannot assign a value to the address of anything &cp = &c; illegal, same as above ip = &a; illegal, a can be used for its address, which is &a[0], no need to have & ip = a; legal, assign the address of array a, which is &a[0], to ip ip = &a[0]; legal, same as above (ip = a) + n; legal, assign the address of array a to ip and then return the address of a[2]. note that n=2 *((ip=a)+n) = 5; legal, assign the address of array a to ip and then store value 5 to a[2] 2. #defind ELEMENTS 20 // assume that we will read in 20 numbers float *read_array(void) { int count; static float array[ELEMENTS]; /* NOTE use of static array as we are returning its address */ for(count = 0; count right, stop and report not found. 4) a[] = {10, 20}, x = 20 left = 0, right = 1: check = 0, a[0] < 20 left = check = 0, right = 1: check = 0, stays in the while loop infinitely. 5. #include #include int main() { int correctDay = 0; char *day; int i=0; do { day= (char *) malloc(sizeof(char)); printf("Enter a day of the week (Sun, Mon, Tues, Wednes, Thurs, Fri, or Satur):"); i=0; do { scanf("%c",&day[i]); i++; day=(char *)realloc(day,sizeof(char)*(i+1)); }while(day[i-1]!='\n'); // read in the input day[i-1]='\0'; // put \0 so we can do string operation later day=(char *)realloc(day,sizeof(char)*i); // this reduces the size of day by 1 sizeof(char). // It does not affect the correctness if(!strcmp(day,"Sun")|| !strcmp(day,"Mon")||!strcmp(day,"Tues")||!strcmp(day,"Wednes") ||!strcmp(day,"Thurs")||!strcmp(day,"Fri") ||!strcmp(day,"Satur")) { printf("Today is %s",day); printf("day.\n"); correctDay=1; } free(day); }while(correctDay!=1); // the outer do-while loop keeps on asking for input until a valid // day is entered. return 0; } 6. #include int main() { int a1=0; int b1=0; int a2=0; int b2=0; printf("Please enter value of a1 and b1 (with a space between their values):"); scanf("%d %d",&a1,&b1); printf("Please enter value of a2 and b2 (with a space between their values):"); scanf("%d %d",&a2,&b2); if(a1 int main() { int imax=0, imin=0, *p; // imax and imin are the indices for the max and min item in the list int i=0,j; printf("Enter a list of integers:"); p = (int *) malloc(sizeof(int)); do { scanf("%d",&p[i]); if ( p[imax] < p[i]) imax = i; if ( p[imin] > p[i]) imin = i; i++; p =(int *)realloc(p, sizeof(int)*(i+1)); // get ready for next integer }while(getchar() != '\n'); for (j=0; j