Fall 2002 - page 1 of 3 Fall 2002 Consider the following...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: page 1 of 3 Fall 2002 Consider the following declarations: double one[10]={1.0,2.1,3.5,4.8,5.3,6.7,7.2,8.1,9.3,10.4}; double two[5][5],*ptr, value=1.0; 1.(12pts, 2 each) )Indicate whether each of the following statements would be valid or invalid, and if invalid, why. Consider each statement separately. a. two[3,0] = 25.3; invalid, need separate brackets: two[3][0] b. ptr = &one; invalid, one is a pointer constant, should not use & c. ptr = two[2]; invalid, ptr is pointer to double, two[2] is pointer to array of doubles d. value = two[3][5]; invalid, second subscript is out of bounds e. printf("%lf\n", two[1]); invalid, two[1] is a pointer not a double f. one = &two; invalid, one is a pointer constant which cannot be reassigned 2.(4pts, 1 each)Which of the following would reference the same value as two[1][3]? Circle all that are equivalent. a. two[4]; b. *(*(two+1)+3); c. *(*(two+3)+1); d. *(*two+8); unix produces warning but it works Consider the following declaration: char s1[16]="Rats", *s2 = "A1"; Indicate whether each of the following statements would be valid or invalid by circling those that are...
View Full Document

This note was uploaded on 10/26/2011 for the course ECE 3331 taught by Professor Staff during the Spring '08 term at University of Houston.

Page1 / 3

Fall 2002 - page 1 of 3 Fall 2002 Consider the following...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online