Why not just use #include <cstdlib>?

I've been looking at examples and tutorials of code since I started getting into programming and I've noticed that when cout is used most more advanced programmers tend to use std::cout rather than just including cstdlib at the beginning of the file. Is cstdlib a c++ thing and mostly c programmers use std::cout? I mean I know it's not just cout but I see this a lot.
<cstdlib> has nothing to do with whether or not you write std::cout or cout. std::cout is defined in <iostream>. Neither is it a matter of C++ vs. C (considering that std:: only exists in C++).

I think you are thinking about: using namespace std;, for which you can find many posts about.
Oh, you know I was thinking it was the using namespace std; right after I posted this, but why do some programmers not use it then? I've seen many people just using the std::[call] a ton of times in their programs where they could have just used the using namespace std; to write less.
using namespace std is bad practice because if you were to have a function or variable the same name as something within std would conflict.

NOTE:
I'm still learning c++ so someone might have a better explanation than me or I might be completely wrong, so don't quote me on this.
closed account (N36fSL3A)
Is cstdlib a c++ thing and mostly c programmers use std::cout? I mean I know it's not just cout but I see this a lot.

wut

ctdlib is a C++ version of C's standard libraries. In C, std::cout doesn't exist. It's only a C++ standard library thing.

If a C++ programmers uses that they're either using it for backwards compatibility, a function in C is faster than the C++ version, or they're really just a C programmer using a C++ compiler.
Last edited on by Fredbill30
Topic archived. No new replies allowed.