1__Questions_ArraysAndPtr_10

1__Questions_ArraysAndPtr_10 - CIS 15BG 1 Questions Chapter...

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

View Full Document Right Arrow Icon
CIS 15BG Questions Chapter 10: POINTER APPLICATIONS Pointers and Arrays 1. Why are pointers important? (A). (B). (C). 2. (A) What does function fun do? (B) What does word contain after the call? (C) Change this function using pointers instead of indices. Cross and replace a statement or modify an existing statement (do not rewrite everything!) 1 . . . char word[8] = {'s', 't', 'r', 'e', 's', 's', 'e', 'd'}; int size = 8; fun( word, size ); . . . /* ============================== */ void fun( char word[], int size ) { int first; int last; char temp; first = 0; last = size – 1; while( first < last ) { temp = word[ first ]; word[ first ] = word[ last ]; word[ last ] = temp; first++; last--; } return; }
Background image of page 1

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

View Full DocumentRight Arrow Icon
CIS 15BG Questions Chapter 10: POINTER APPLICATIONS Pointers and Arrays 3. An array contains mid-term exam scores. Write a function that counts the number of scores greater than or equal to a given score. Use a pointer to traverse the list (i.e. NO index!). Then call it from main. (If you wish, use Q4_Question_4.c to answer
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/02/2011 for the course CIS 15BG taught by Professor Staff during the Winter '10 term at DeAnza College.

Page1 / 4

1__Questions_ArraysAndPtr_10 - CIS 15BG 1 Questions Chapter...

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

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