Site icon Bytefreaks.net

C++: Print a string using printf (stdio.h)

Advertisements

In order to print a string in C++ using the printf from the stdio.h library use it as follows:

string Phrase = "Hello!!";
printf("Phrase: %s\n",phrase.c_str());

 

This post is also available in: Greek

Exit mobile version