...the asker just could have tried the actual code
You have to be really careful making that assumption about programming questions, particularly in languages like C and C++ where you can have undefined behavior. In other words, just because a particular piece of code appears to run and work on your system's implementation of C does not mean that it is valid C and that you can assume it will work identically across all implementations.
Sometimes questions that look really simple are actually hiding quite a bit of complexity just under the surface. Closing these questions as "shoulda just tried the damn code" is thus not very constructive and definitely sends the wrong message.
And I say all of that as someone who regularly uses all 50 of his close votes on Stack Overflow. You have to be careful closing questions for this reason alone. Sometimes I will leave a comment that says something like,
This shouldn't be a problem; have you tried running the code yourself? What happened?
and see if they respond with "oh yeah guess I could . . . edit: it works! herp derp" before voting to close. On the other hand, if they indicate that they're aware one can compile and test code, but they're looking for a different answer, then that question deserves to remain open (perhaps with an edit or two clarifying the subtleties).
The first question you cite is a good example:
In C, if I do
printf("something");, will it print
something to screen?
The answer is actually a bit more complicated than "yes" or "no". Yes, in most cases it will print to the screen. But the
printf function actually prints to the standard output stream. That's usually the screen, but it doesn't have to be. Et cetera. That's the kind of answer that should ideally be given, not "yes, it prints to the screen; try the freakin' code yourself".
Keep in mind that there is no question too "simple" or "basic" for Stack Overflow. As long as it is well-asked and reasonably answerable, it should be allowed. The "RTFM" close reason has not yet been approved, and for good reason (I think).
Anyway, end of rant. If you do come across a question that is literally "what does this code do?" (as opposed to, perhaps, "what does this code mean?" or a whole host of other potentially complex questions—see how tricky it is to make general rules about this kind of thing?), then yes, voting to close as either "too localized" or "not a real question" would be appropriate.
If not enough users agree with your close vote, well then you were probably wrong. That's entirely by design and why closing requires 5 votes. Don't sweat it too much.