当前位置:   article > 正文

C语言将两个正整数连接_c语言strcat连接整形

c语言strcat连接整形
  1. //c语言将两个正整数连接
  2. int main()
  3. {
  4. int number1 = 1;
  5. int number2 = 2;
  6. char string1[5];
  7. char string2[5];
  8. /*VS2017编译器中这种形式提示不安全
  9. itoa(number1, string1, 10);
  10. itoa(number2, string2, 10);
  11. strcat(string1, string2);//strcat连接两个字符串
  12. */
  13. _itoa_s(number1, string1, 10);
  14. _itoa_s(number2, string2, 10);
  15. strcat_s(string1, string2);
  16. int result = atoi(string1);
  17. printf("result = %d ", result);
  18. getchar();
  19. return 0;
  20. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/花生_TL007/article/detail/252577
推荐阅读
相关标签
  

闽ICP备14008679号