output writing example strcpy, strcat – CSKC
Sign In

Search

Solved Problem! #CPP#2649    siteicon   siteicon  

Problem Statement - output writing example strcpy, strcat

Write the output of the following program.

TC++ #2649

×

Ask AI About This Code

Default Prompt that is passed along with the code is given below, You can write your own prompt if you so desire.



×

Test CPP

Solution


char str1[]=”World”; //Initialised with 5 characters of the rod World
char str2[20]; //Decalred array of size 20.
strcpy(str2,str1); //str2 will contain 5 characters of str1
strcat(str2,” is beautiful”); //str2 will be concatenated by 13 characters of given string.

cout<<str1<<” “<<strlen(str2);
So this will print World 18 .

Common Errors

  • In such codes watch carefully the size of array and the functions used before printing.


Share

Created: 15-Jan-2018 23:15 | Updated: 15-Jan-2018 23:16|