给出下面函数的可能输出,若有错,指出错误
void test1()
{
char *in,*out;
sprintf(in,"%s","test");
sprintf(out,"%s",in);
}
```c
假设a为常数V1,b为常数V2,给出下面函数的执行结果
#include<stdio.h>
int main()
{
Int a = V1, b = V2;
a = a^b;
b = a^b;
a = a^b;
Printf(“a=%d b=%d\n”,a,b);
}
给出下面函数的可能输出,若有错,指出错误
void test1()
{
char *in,*out;
sprintf(in,"%s","test");
sprintf(out,"%s",in);
}
```c
假设a为常数V1,b为常数V2,给出下面函数的执行结果
#include<stdio.h>
int main()
{
Int a = V1, b = V2;
a = a^b;
b = a^b;
a = a^b;
Printf(“a=%d b=%d\n”,a,b);
}
in和out都没有分配空间,sprintf是不行的
第二个是a和b交换了值,输出结果是a=V2的值,b=V1的值