strcat segmentation fault

前端 未结 7 1822
后悔当初
后悔当初 2021-01-24 01:50

The second call to strcat here is generating a segmentation fault, why?

#include 
#include
#include 

        
7条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-24 02:11

    whitespaceseparator isn't big enough to contain the concatenated string, so you're causing undefined behaviour.

    Using gets is normally frowned upon, too.

提交回复
热议问题