strcat segmentation fault

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

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

#include 
#include
#include 

        
7条回答
  •  野性不改
    2021-01-24 01:55

    strcat doesn't do what you think. It modifies the string pointed to by its first parameter. In this case, that string is contained in a 2-byte array, which is therefore overrun.

提交回复
热议问题