Advertisement
Infiniti_Inter

add char to char*

Apr 16th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.19 KB | None | 0 0
  1. char* appendCharToCharArray(char* array, char a)
  2. {
  3. size_t len = strlen(array);
  4.  
  5. char* ret = new char[len + 2];
  6. strcpy(ret, array);
  7. ret[len] = a;
  8. ret[len + 1] = '\0';
  9. return ret;
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement