printf() does nothing special here. C doesn't require you to do anything with the result of expressions you evaluate.
2 + 3;
is a perfectly valid statement. (It may generate a warning from your compiler because it doesn't actually do anything, unlike a function call such as printf().)
Let's look at a slight variation of your second version:
int var;
var = printf("%d", 10);
Here you might think we're "catching" the return value from printf in var, so there's no result value being left lying around. But = is just another operator (like + or &&) and it returns a value!
int x, y, z;
x = (y = (z = 42)); // perfectly valid code
x = y = z = 42; // same thing; = is right associative
= returns the value being assigned and this code sets all three variables to 42.
So if C were to require you to "catch" return values, you couldn't use assignment statements because they also return a value.
int printf()returns the number of written characters if you are on C/C++, and a negative number on error. See here. To catch errors you can simply doif( printf(...) < 0 ) manageerror();Note that it does not output the number of items but characters (newline is 1, any byte is 1)printf()work internally to resolve this?" --printf()(or any other function that returns a value) doesn't care what happens with the value it returns. It always returns it and completes; it's up to the calling code to use or ignore the returned value.Cand other languages inspired from it allow calling a function without using the value it returns.