That might or might not be enough for what you are trying to store in it in your case, the number of vowels, in any given word. You are accessing v as if it were pointing to a location holding a number of characters, when indeed you only reserve space for one single char * (usually 4 byte on a 32 bit machine and 8 byte on a 64 bit machine): char *v = malloc(sizeof(char *)) If (( file = fopen("/usr/share/dict/words", "r") ) = NULL)įprintf(stderr, "cannot open %s\n", "/usr/share/dict/words") int all_vowels( char *s )Ĭonst unsigned char *p = (const unsigned char *)s Ive been challenged to find all words in the usr/share/dict/linux.wordsįile using fopen, fgets etc with every vowel only once, in order.
0 Comments
Leave a Reply. |