#include<stdio.h> #include<string.h> main() {char a[20]="ABCD尀OEFG尀0",b[ ]="IJK"; strcat(a,b); p...

2025-12-15 04:27:25
推荐回答(2个)
回答1:

你如果确信你的数据是"ABCD\OEFG\0" D后是\O(字母O,而不是0)
则你的程序运行结果是: ABCDOEFGIJK
如果你的数据是:"ABCD\0EFG\0" D后是\0(数字0)
则你的程序运行结果是: ABCDIJK

strcat时是从第一个地址位置开始,先找到\0位置,然后将第二个指针所指的内容连到其后。

回答2:

会闪退

#include #include main() {char a[20]="ABCD\OEFG\0",b[ ]="IJK"; strcat(a,b); printf("%s",a); }

 如果按以下做是病毒

#include  
#include  
main()  
{char a[20]="ABCD\OEFG\0" 
,b[ ]="IJK"; strcat(a,b); printf("%s",a); }