C++: printf Vs cout

Y

Ying Yang

Hi,

Whats the difference between printf and cout? They both seem to do the same
thing.


Regards
dsfg
 
T

tom_usenet

Hi,

Whats the difference between printf and cout? They both seem to do the same
thing.

printf << "Hello"; //error
cout("%s", "Hello"); //error

In other words, they have completely different syntax. C++ has both, C
only has printf.

In high level terms, the main differences are type safety (cstdio
doesn't have it), performance (most iostreams implementations are
slower than the cstdio ones) and extensibility (iostreams allows
custom output targets and seamless output of user defined types).

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top