Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * removeVowels.c
- * comp1927 sample pracExam
- * write a function with the specified typesignature which
- * given a list of characters returns a pointer to the list with the
- * nodes containing lowercase vowels removed.
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <assert.h>
- #include "list.h"
- list removeVowels (list word);
- // a sample stub non-working solution which compiles
- // but does not pass the tests
- //
- // change anything you wish below here
- // and add any local static functions you wish
- // your code must comply with the course
- // style guide
- //
- list removeVowels (list word) {
- list before, after;
- after = word->rest;
- before = after;
- if (after == NULL) {
- } else if (after->rest== NULL) {
- if (after->value == 'a' ||
- after->value == 'e' ||
- after->value == 'i' ||
- after->value == 'o' ||
- after->value == 'u') {
- word->rest=NULL;
- }
- } else {
- while (after != NULL) {
- if (after->value == 'a' ||
- after->value == 'e' ||
- after->value == 'i' ||
- after->value == 'o' ||
- after->value == 'u') {
- after=after->rest;
- before->rest=after;
- }
- before = after;
- after=after->rest;
- }
- }
- return word;
- }
Add Comment
Please, Sign In to add comment