问题
填空题
以下程序运行后的输出结果是 【16】 。 #include <stdio, h>#include <stating, h>void fun(char * s,int p,int k){ int i; for(i=p;i<k-1;i++) s[i] =s[i+2];}main( ){ char s [] = "abedefg"; fun(s,3 ,strlen(s) ); puts(s);}
答案
参考答案:abcfg
解析: fun函数中for循环语句的作用是将s所指的字符串中从第5个字符到第7个字符依次向前移动两个位置。输出结果为abcfg。