#include void main() { char *p1,*p2,str[50]="ABCDEFG"; p1="abcd" ;p2="efgh"; strcpy(str+1#includevoid main(){ char *p1,*p2,str[50]="ABCDEFG";p1="abcd" ;p2="efgh";strcpy(str+1,p2+1);strcpy(str+3,p1+3); printf("%s\n",str);system ("pause");} 结构题
来源:学生作业学帮网 编辑:学帮网 时间:2024/05/22 13:20:40
#include void main() { char *p1,*p2,str[50]="ABCDEFG"; p1="abcd" ;p2="efgh"; strcpy(str+1
#include
void main()
{ char *p1,*p2,str[50]="ABCDEFG";
p1="abcd" ;p2="efgh";
strcpy(str+1,p2+1);
strcpy(str+3,p1+3);
printf("%s\n",str);
system ("pause");
}
结构题一点都不不会,原因更重要?
devc能执行
这和结构没关系吧
结果是Afgd
str代表str数组首地址,+1表示首地址偏移1个位置,p2+1,p1+3类似
另外注意字符串结尾有个隐含的 '\0'
strcpy(str+1,p2+1);执行完之后,str数组是这样的:A f g h \0 F G \0
strcpy(str+3,p1+3); 执行完之后,str数组是这样的:A f g d \0 F G \0
所以最终输出Afgd
#include void main( ) { int k=-3; if (k
#include void main(void) {int a1=10,a2=3; float a3=8.0; cout
#include reg52.h sbit P1_0 =P1^0; void DELAY(); main() { while(1) { DELAY(); P1_0=~P1_0; } } void
以下程序中,while 循环的次数是#include void main(void){ int i = 0;while (i
#include void main( ) { float x,y; scanf(%f,&x); if(x
#include void main(){int i,j,a=0;for(i=0;i
#include void main( ) { float x,y; scanf(%f,&x); if(x
# include void main() { int y=10; while(y--); printf(y=%d,y); }
九九乘法表程序#include void main(){int i,j,a;for(i=1;i
#include void main() { int i;int sum=0; for(i=1;i
#include void main() { int a[3][3],i,j; for(i=0;i
#include void main() { int y=10; do{ y--; } while(--y); printf(%d
,--y); }
#include void main() { int a,b,c; for(a=1; a
#include void main() { int a,c; a=0; if (a
编程分段函数#include void main(){int x,y;scanf(%d,&x);if(x
# include void main( ) { int x = 4 ; do { printf( %d ,x-- ) ; } while( x ) ; }
#include void main() { char a1='M',a2='m'; printf(%c
,(a1,a2)); }
#include void main(){int a[30];int i;for (i=0,i