Computer Science, asked by darkggod, 10 months ago

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 Anonymous
1

Answer:

do yourself please ok by

Similar questions