Segmentation fault in strtok
问题 I keep getting that error. I am pretty sure it has something to do with memory allocation but i'm not quite sure how to fix it. #include <stdio.h> #include <stdlib.h> #include <limits.h> #include <string.h> char * VOWELS ="aeiouAEIOU"; void printLatinWord(char *a); int main(int argc, char **argv){ char phrase[100]; char *word = malloc(sizeof(char) *100); printf("Enter the phrase to be translated: \n"); fgets(word, 100, stdin); printf("The phrase in Pig Latin is:\n"); word = strtok(phrase, " "