0

Cout is similar to printf in c?

cout is similar to printf in c?

7th Nov 2016, 4:11 PM
Swaran
Swaran - avatar
3 Antworten
+ 6
The only thing similar is that both are used for console output, besides that they are totally diferent, cout is an object of ostream and printf a function of stdio.h, so the syntax are very different!
7th Nov 2016, 5:10 PM
Hector Sulbaran
Hector Sulbaran - avatar
+ 1
Yeah, the purpose of both is the same. The printf is from oldies libraries, the cout from newest objective. As you can see, for printf you have always to declare the specifier (type of variable for output). For cout not,because it is written in libraries ( OOP technique operator overloading) . So your coding with cout is more simple and more safety
7th Nov 2016, 5:16 PM
Petr Hatina
Petr Hatina - avatar
0
@kamyab in java its system.out.print ?
7th Nov 2016, 11:21 PM
Swaran
Swaran - avatar