Exercises from Chapter 11,12 of King
- Given the following declarations
int i;
int *p,*q;
Which of the following assignments are legal
p=i;
*p=&i;
&p=q;
p=&q;
p=*&q;
p=q;
p=*q;
*p=q;
*p=*q;
- Write the following function
void find_two_largest(int a[], int n, int *largest, int *second_largest);
- What will be the contents of array
a
after the following code is executed?
#define N 10
int a[N] = {1,2,3,4,5,6,7,8,9,10};
int *p=a,*q=a+N-1;
while(p<q){
int temp=*p;
*p++=*q;
*q--=temp;
}