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
totoo po ba ang manga aliens!
how to use C++?
draw a flowchart that accepts two numbers and checks if the first is divisible by the second.
What are the symptoms of stl?
What are the different types of stl containers?
When did c++ add stl?
Explain stl.
What do stl stand for?
What is stl in oop?
Define stl.
sir please send me bpcl previous question papers
How does an stl file work?
To modify an, existing worksheet. What steps are involved for: 1. Inserting and deleting rows and columns. 2. Printing cell formulas 3Jld displayed values 3. Using the page setup command
What is stl stack?
What are the various types of stl containers?