I'm reading the book The Practice of Programming by Brian W.Kernighan, and I don't quite understand exercise 1-5 in it.
Exercise 1-5. What is wrong with this excerpt?
int read(int *ip) {
scanf("%d", ip);
return *ip;
}
...
insert(&graph[vert], read(&val), read(&ch));
insert(&graph[vert], read(&val), read(&ch));
It's unspecified whether read(&val)
is called first, or read(&ch)
is called first, so you never know which one you are inputting.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With