All About C++

Get Pure Concepts of C++

Tuesday 1 March 2016

What is concatenation between strings in C++ with code example

Concatenation between strings in C++

Concatenation combines two or more strings together. Here is a code to understand its concept:

#include <iostream>
#include <string>

using namespace std;
void main() {
      string a("abcd efg");
      string b = "xyz ijk";
      string c = a + b; // concatenation
      cout << "First character of " << c << endl; // as in C

      system("pause");

}

No comments:

Post a Comment