3/12/2018

BCS1013 Prob Solving & Comp Programming . Array. Exercise/ Lab 13/3/2018


1. Describe the difference in the meaning of int a[5]; and the meaning of a[4]. What is the meaning of the [5] and [4] in each case?

2. In the array declaration 
double score[5];
state the following.
a. The array name
b. The base type
c. The declared size of the array
d. The range of values that an index for this array can have
e. One of the indexed variables (or elements) of this array



x




4. Consider the following function definition:

void too2(int a[], int how_many)
{
   for (int index = 0; index < how_many; index++)
   a[index] = 2;
}

Which of the following are acceptable function calls?

int my_array[29];
too2(my_array, 29);
too2(my_array, 10);
too2(my_array, 55);
“Hey too2. Please, come over here.”
int your_array[100];
too2(your_array, 100);
too2(my_array[3], 29);

5. Write a function definition for a function called one_more, which has a formal parameter for an array of integers and increases the value of each array element by one. Add any other formal parameters that are needed.


6. Create an array that can hold ten integers, and get input from user. Display those values on the screen, and then prompt the user for an integer. Search through the array, and count the number of times the item is found.

No comments:

Cara download Installer windows 10 dalam format ISO

1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan.  ...