Inserting characters in the middle of char array

后端 未结 5 1182
南方客
南方客 2021-01-23 03:51

I have a char array filled with some characters. Let\'s say I have \"HelloWorld\" in my char array. (not string. taking up index of 0 to 9)

What I\'m trying to do is ins

5条回答
  •  囚心锁ツ
    2021-01-23 04:30

    If you're going to manipulate a char array you shouldn't make it static. By doing this:

    char ch[15];
    

    you're hardcoding the array to always have 15 characters in it. Making it a pointer would be step 1:

    char* ch;
    

    This way you can modify it as need be.

提交回复
热议问题