网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

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

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

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


参考答案

更多 “ void Test(void){char *str = (char *)malloc(100); strcpy(str, “hello”); free(str); if(str != NULL) { strcpy(str, “world”); printf(str);}}请问运行 Test 函数会有什么样的结果? ” 相关考题
考题 void setmemory(char **p, int num){ *p=(char *) malloc(num);}void test(void){ char *str=NULL;getmemory(str,100);strcpy(str,"hello");printf(str);}运行test函数有什么结果?( )

考题 有关内存的思考题1. void getmemory(char *p){ p=(char*)mallol(100);}void test(void){char * str =null;getmemory(str);strcpy(str,”hello,world”);printf(str);}请问运行 Test 函数会有什么样的结果

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

考题 以下为 Windows NT 下的 32位 C++程序,请计算 sizeof的值char str[] = “Hello” ; char *p = str ;int n = 10;请计算 sizeof (str )= sizeof ( p ) = sizeof ( n ) = void Func (char str[100]){请计算 sizeof( str ) = }void *p = malloc( 100 );请计算 sizeof ( p ) =

考题 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 world";returnp; }void Test(void){char *str = NULL;str = GetMemory(); printf(str);}请问运行 Test 函数会有什么样的结果?

考题 Void GetMemory2(char **p, int num){*p = (char *)malloc(num);}voidTest(void){char *str = NULL;GetMemory(str, 100);strcpy(str, "hello"); printf(str); }请问运行Test 函数会有什么样的结果?

考题 下面的程序各自独立,请问执行下面的四个TestMemory 函数各有什么样的结果?①void GetMemory(char * p){p = (char * )malloc(100);}void TestMemory (void){char *str = NULL;GetMemory (str);strcpy(str, "hello world");prinff(str);}② char * GetMemory (void){char p[ ] = "hello world";return p;}void TestMemory (void){char * str = NULL;str = GetMemory( );printf(str);}③void GetMemory(char * * p, int num){* p = (char * )malloc(num);}void TestMemory (void){char * str = NULL;GetMemory(str, 100);strcpy( str, "hello" );printf(sir);}④void TestMemory (void){char *str = (char * )malloe(100);strepy (str, "hello" );free ( str );if(str ! = NULL){strepy( str, "world" );printf(str);}}

考题 分析下面的程序,指出程序中的错误: # include <stdio.h> int main(void) { char a; char *str=a; strcpy(str,"hello"); printf("%sn",str); return 0; }