Tech Study

How To Concatenate Two Strings In C++ Using Pointers


I have used CodeBlocks compiler for debugging purpose. But you can use any C++ programming language compiler as per your availability.

#include <iostream>
#define MAX_SIZE 100 // Maximum size of the string
using namespace std;
int main() {
    char str1[MAX_SIZE], str2[MAX_SIZE];
    char * s1 = str1;
    char * s2 = str2;
    // Inputting 2 strings from user
    cout<<"Enter 1st string: ";
    cout<<"Enter 2nd string: ";
    // Moving till the end of str1
    // Coping str2 to str1
    while(*(s1++) = *(s2++));
    cout<<"Concatenated string:"<<str1;
    return 0;


Write C++ program to concatenate two strings using pointer

Write C++ program to count number of alphabets, digits and special characters in string

Write C++ program to convert a string to upper case


TaggedWrite C program to concatenate two strings using pointer

Python Examples

Introduction: Python Examples are the basic programming concepts of python like python syntax,python data types,,python operators,python if else,python comments etc.. …

Read more

C String Functions

C String Functions perform certain operations, It provides many useful string functions which can come into action. The <string.h> header …

Read more