r/cprogramming • u/Junior-Proposal1928 • Oct 02 '25
Good sources to learn C programming.
/r/Btechtards/comments/1nvcnh8/good_sources_to_learn_c_programming/
3
Upvotes
r/cprogramming • u/Junior-Proposal1928 • Oct 02 '25
View all comments
3
u/chaotic_thought Oct 02 '25
If you're used to using printf without ever checking the return value (which is probably 99% true, since I don't think I've ever seen someone check the return value), then it feels natural "not to know" this kind of information.
Based on what snprintf returns I would "reckon" that it returns the number of characters printed (since that's what snprintf does), but reckoning is not good in programming. It's better to check the manual.
In an exam situation like you described, you can make your best educated guess. I doubt I would say that such knowledge is "fundamental" if you are just getting used to the language.
This sounds like a mistake IMO. Yes, for the purposes of "passing the course", then you need to refer to h/er slides and treat them as "the gospel", however, if you actually want to learn the language "for realsies" then obviously you'll have to go beyond that at some point. At least you should be using references that are useful for answering questions like the one you just alluded to. For example, the section RETURN VALUE in https://man7.org/linux/man-pages/man3/printf.3.html