[主观题]

void Test(void){char *str = (char *)

malloc(100); strcpy(str, “hello”); free(str); if(str != NULL) { strcpy(str, “

world”); printf(str);}}请问运行 Test 函数会有什么样的结果?

参考答案与解析:

相关试题

void func(char str[100]) { }

[主观题]void func(char str[100]){ }

  • 查看答案
  • void func(char str[100]) { }

    [主观题]void func(char str[100]){ }

  • 查看答案
  • 考虑函数原型void test(int a,int b=7,char z=‘*’

    [单选题]考虑函数原型void test(int a,int b=7,char z=‘*’),下面的函数调用中,属于不合法调用的是( )。A.test(5);B.test(5,8);C.test(6,’#’);D.test(0,0,’x’);

  • 查看答案
  • char*getmemory(void) { char p[]=”hello w

    [主观题]char*getmemory(void){ char p[]=”hello world”;return p;}void test(void){char *str=null;str=Getmemory();printf(str);} 请问运行 Test 函数会有什么样的结果.

  • 查看答案
  • char*getmemory(void) { char p[]=”hello w

    [主观题]char*getmemory(void){ char p[]=”hello world”;return p;}void test(void){char *str=null;str=Getmemory();printf(str);} 请问运行 Test 函数会有什么样的结果.

  • 查看答案
  • void GetMemory(char *p){p = (char *)mall

    [主观题]void GetMemory(char *p){p = (char *)malloc(100);}void Test(void) {char *str= NULL;GetMemory(str); strcpy(str, "hello world");printf(str);}请问运行 Test 函数会有什么样的结果?

  • 查看答案
  • char *GetMemory(void){ char p[] = "hello

    [主观题]char *GetMemory(void){ char p[] = "hello world";returnp; }void Test(void){char *str = NULL;str = GetMemory(); printf(str);}请问运行 Test 函数会有什么样的结果?

  • 查看答案
  • char *GetMemory(void){ char p[] = "hello

    [主观题]char *GetMemory(void){ char p[] = "hello world";returnp; }void Test(void){char *str = NULL;str = GetMemory(); printf(str);}请问运行 Test 函数会有什么样的结果?

  • 查看答案
  • 考虑函数原型void test(int a, int b=7,char z='*

    [单选题]考虑函数原型void test(int a, int b=7,char z='*'),下面的函数调用中,属于不合法调用的是A.test(5);B.test(5,8);C.test(6,'#');D.test(0,0,'*');

  • 查看答案
  • 有以下程序void swap(char *x,char *y){ char t;

    [单选题]有以下程序void swap(char *x,char *y){ char t;t=*x; *x=*y; *y=t;}main(){ char *s1="abc",*s2="123";swap(s1,s2);printf(" % s, % s/n",s1,s2);}程序执行后的输出结果是A.)123,abcB.)abc,123C.)1bc,a23D.)321,cba

  • 查看答案
  • void Test(void){char *str = (char *) mal