You have to use a switch statement the results for a

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: () has local copies to x and y, and the changes of x and y will be local to swap(). Revise code as follows: // swap the contents of x and y void swap (int *x, int *y) { int tmp; } tmp = *x; *x = *y; *y = tmp; // example of using swap() void call_swap() { int a, b; … swap (&a, &b); … } Question 2: Switch Statement (10 pts) Complete the following function that counts the number of each vowel, namely a, e, i, o, u and y and their upper case, in a C string. You have to use a switch statement. The results for a, e, i, o, u should be stored in an array of five element in the same sequence; for example, element 0 stores the result for a, element 1 for e, and so on. See the comments for more information. The following is an example how the function is to be called. char message = ”Welcome to CprE 288”; int counter[5]; int c...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online