Write a program in C++ to concatenate two strings into third
string using pointers
Answer Posted / naman patidar
#include <iostream.h>
#include <string.h>
void main(){
char *str1 = "First String";
char *str2 = "Second String";
int len = strlen(str1)+strlen(str2)+1;
char *result = new char[len];
int i ;
for( i =0 ; i<strlen(str1); i++){
result[i] = str1[i];
}
for(int j=0; j<strlen(str2); j++, i++) {
result[i] = str2[j];
}
result[i] ='\0';
cout<<result;
}
| Is This Answer Correct ? | 88 Yes | 58 No |
Post New Answer View All Answers
Is stl part of c++ standard?
What two types of containers does the stl provide?
Define stl.
Explain stl.
What is meant by stl in c++?
Is there any error below, its a code to delete all entires from a map #include
What is the use of stl?
What are the components of stl?
Describe the My Computer and My Documents folders; identify the elements that are present in every Window.
What are the various types of stl containers?
help me i need a c++ program which takes sequesnce of characters and outputed sequence of their token taypes, work same compiler in lexical analysis phase
What does stl stand for in basketball?
please visit this site you'll find my question this is my homework please answer it if you can http://easyscience.org/ib/lofiversion/index.php/t36168.html
What do stl stand for?
How connect plc and pc through software