Sizeof String C++ Code Example


Example 1: c++ string size

// C++ string size str.length(); str.size();			// synonym

Example 2: create a string of length c++

#include <string> #include <iostream>  int main() {     std::string s(21, '*');      std::cout << s << std::endl;      return 0; }

Example 3: c++ string size

// string::size #include <iostream> #include <string>  int main () {   std::string str ("Test string");   std::cout << "The size of str is " << str.size() << " bytes.\n";   return 0; }

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable