HW2: Solutions

2.11 (b) 10.3125 (c) 14.03125
2.12 (a)10.01 (c)1.000101100110011
2.14 (b)be800000 (c)-16
2.19 Assume A is the starting address of the matrix and B is the size in bytes of the data type. Address A [row,col]=A+(col*m+row)*Z
2.21

  1. char NAME="Bill";
  2. s1="George" s2="flies!"
    s2="Word"

2.24
void strdel(char *s, int i, int n)
{
	int len = strlen(s), k;
	
	//exit if index i exceeds length of s.
	if(i>strlen(s))
		return;
	
	k=(i+n>len)?len:i+n;
	//collapse the gap in s
	strcpy(&s[i],&s[k]);
}
	

2.26 Not Done.