I'm making a binary tree search for an assignment and Ive got all the structs and methods working and done, but a requirement is to read 10 words and input them and we are given the code here, but for some reason after 2 scanfs the program crashes, but if i do one scanf and press X it runs fine just anything more then 2 it'll crash does anyone know why? this is in C btw
printf("Enter 10 words for the binary search tree.(Click X to stop adding words): ");
while(true) {
int cnt = scanf("%s", word);
if (cnt != 1 || strcmp(word, "X") == 0)
break;
findOrInsert(&bt1, word);
}
Answers
Answered by
1
Answer:
do yourself please ok by
Similar questions
History,
5 months ago
World Languages,
5 months ago
History,
10 months ago
Biology,
10 months ago
Chemistry,
1 year ago
Social Sciences,
1 year ago