1
#include<iostream>

int main() {

std::string str = "Hello";

std::cout << str << std::endl;

return 0;

}

As I learned from various places, whenever you want to use std::string you should include string header file.

However, the code above does not require #include<string> to run, why is that so?

note: I am using g++ to compile it from bash terminal.

muyustan
  • 1,555
  • 1
  • 11
  • 23

0 Answers0