fork download
  1. #include <iostream>
  2.  
  3. #define TO_STRING_HELPER(x) #x
  4. #define TO_STRING(x) TO_STRING_HELPER(x)
  5. #define CONCAT(x, y) *x##y
  6.  
  7. int main() {
  8. char *pcCommPort = "COM";
  9. char *num = "5";
  10. std::cout << TO_STRING(CONCAT(pcCommPort, num)) << std::endl;
  11. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
*pcCommPortnum