C++ program to concatenate strings






Here we will learn how to write a program to Concatenate strings.

CONCATENATION OF TWO STRINGS USING C++ PROGRAM

 


Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com


Stuff I use to make videos

Windows notebook – http://amzn.to/2zcXPyF

Apple MacBook Pro – http://amzn.to/2BTJBZ7

Desktop - http://amzn.to/2zct252

Microphone – http://amzn.to/2zcYbW1

notebook mouse – http://amzn.to/2BVs4Q3

Screen Recording Software – Camtasia


  • Jürg Brandenberger

    I have a heavy fight with string Constant in c/c++, and I would like to know the cleanest and most elegant way to achieve the goal.
    A given string may be used in more than one place in your program. It is good programming praxis to define a string constant in one place and then use it ever where you need. Hence in Java I would say:
    public/private static final String MY_STRING_REF = “whatever I need”;

    It’s obvious, that if I must change the String to say “whatever I need now!”, I change it exactly in one place and with the next compiler run the new string is available where ever it was referenced. Beside the string value is stored exactly once in the program space.

    I would like to apply this praxis to c++ too. But if your c++ programs use old structures from c, things turn ugly!
    Example:
    JavaVMOption* options = new JavaVMOption[1]; // JVM invocation options
    options[0].optionString = (char *)CLASSPATH;
    Yes, this is old JNI interface to access OS-services from Java through c++

    I have found a kind of declaration without complains from the compiler as:
    const char * CLASSPATH = “-Djava.class.path=.:./xx”;

    This works. But I don’t like the type cast and I would be happy to know a more elegant way to achieve it. Maybe this could be a good example for your tutorial site.