Skip to content

Commit

Permalink
improved formatting for ex3_40
Browse files Browse the repository at this point in the history
  • Loading branch information
pezy committed May 20, 2015
1 parent 8fa6d50 commit 2a59d1f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions ch03/ex3_40.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const char cstr2[]="world!";
int main()
{
constexpr size_t new_size = strlen(cstr1) + strlen(" ") + strlen(cstr2) +1;
char cstr3[new_size];

strcpy(cstr3, cstr1);
strcat(cstr3, " ");
strcat(cstr3, cstr2);

std::cout << cstr3 << std::endl;
char cstr3[new_size];
strcpy(cstr3, cstr1);
strcat(cstr3, " ");
strcat(cstr3, cstr2);
std::cout << cstr3 << std::endl;
}

0 comments on commit 2a59d1f

Please sign in to comment.