#include sub1(char a,char b) {char c;c=a;a=b;b=c;} sub2(char
来源:学生作业帮 编辑:神马作文网作业帮 分类:综合作业 时间:2024/11/19 22:57:17
#include sub1(char a,char b) {char c;c=a;a=b;b=c;} sub2(char *a,char b) {char c;c=*a;*a=b;
你要问的是这个吧...我也在做这个
# include "stdio.h"
void sub1(char a,char b)
{ char c; c=a; a=b; b=c; }
void sub2(char *a,char b)
{ char c; c=*a; *a=b; b=c; }
void sub3(char *a,char *b)
{ char c; c=*a; *a=*b; *b=c; }
void main()
{ char a,b; a='A'; b='B';
sub3(&a,&b); putchar(a); putchar(b);
sub2(&a,b); putchar(a); putchar(b);
sub1(a,b); putchar(a); putchar(b);
}
答案是BAAAAA
sub3(&a,&b);a,b交换值,得a = 'B',b = 'A';
sub2(&a,b);b的值再赋给a,得a = 'A',b作为形参,值不变,b = 'A'
sub1(a,b);a,b都为形参,a,b的值都不变,a= 'A',b = 'A'.
# include "stdio.h"
void sub1(char a,char b)
{ char c; c=a; a=b; b=c; }
void sub2(char *a,char b)
{ char c; c=*a; *a=b; b=c; }
void sub3(char *a,char *b)
{ char c; c=*a; *a=*b; *b=c; }
void main()
{ char a,b; a='A'; b='B';
sub3(&a,&b); putchar(a); putchar(b);
sub2(&a,b); putchar(a); putchar(b);
sub1(a,b); putchar(a); putchar(b);
}
答案是BAAAAA
sub3(&a,&b);a,b交换值,得a = 'B',b = 'A';
sub2(&a,b);b的值再赋给a,得a = 'A',b作为形参,值不变,b = 'A'
sub1(a,b);a,b都为形参,a,b的值都不变,a= 'A',b = 'A'.
#include main(){ static char *a,*b="vhgfj";static char*c=a;f
main() { char a[]={'a','b','c','d'}; char *p=(char *)(&a+1);
fun(char*a,char *b,char *c){while(*a&&*b){*c=*a; c++; a++;*c
char a = 100; char b = 150; unsigned char c ; c =(a < b)?a:b
char a[7]="abcdef" char b[4]="ABC" strcpy(a,b) printf("%c",a
Char a[]=”country’; Char b[]=”ganme” Strcpy(a,b) Printf(“%c”
C语言 point(char*pt); main() {char b[4]={'a','c','s','f'},*pt=
#include #include main() { char p[20]={'a','b','c','d'},q[]=
有数组char x[]="abcdefg"; char y[]={'a','b','c','d','e','f','g'
如果有下列定义:char acX[ ]= "abcdefg"; char acY[ ]= {'a','b','c','d
简述char ch[]={‘a’,‘b’,‘c’};与char ch[]=“abc”;差别.
下列赋值语句,不正确的是?A.char c='a' B.char c=“a“ C.char c=97 D.int c=‘