设有如下的程序段: char str[]="Hello"; char *ptr; ptr=str; 执行完上面的程序段后,*(ptr+5)的值为( )。
A.'o'
B.'\0'
C.不确定的值
D.'o'的地址
第1题:
设有如下程序段: char str[]="World": char*ptr=str; 执行上面的程序段后,*(ptr+5)的值为 ______。
A.‘0’
B.‘\0’
C.不确定的值
D.‘o’的地址
第2题:
设有如下程序段: char str[]=”World”; char*ptr=str; 执行上面的程序段后,*(ptr+5)的值为 ______。
A.‘o’
B.‘0’
C.不确定的值
D.‘o’的地址
第3题:
设有下列程序段:
char str[]="HelloWorld":
char* plr;
ptr=str:
执行上面的程序段后,*(ptr+10)的值为( )。
A. '\0 '
B.'0'
C.不确定的值
D.'0'的地址
第4题:
设有下列的程序段: char str[]="HelloWorld"; char*ptr; ptr==str; 执行上面的程序段后,*(ptr+10)的值为( )。
A.'\0'
B.'0'
C.不确定的值
D.'0'的地址
第5题:
下面的程序各自独立,请问执行下面的四个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);
}
}
第6题:
设有如下的程序段: char str[]="HelloWorld"; char*ptr; ptr=str; 执行上面的程序段后,*(ptr+10)的值为( )。
A.'\0'
B.'0'
C.不确定的值
D.'0'的地址
第7题:
设有下列的程序段:
char str[]="HelloWorld";
char*ptr;
ptr=str;
执行上面的程序段后,*(ptr+10)的值为( )。
A.'\0'
B.'0'
C.不确定的值
D.'0'的地址
第8题:
设有下列的程序段: char str[]="Hello World"; char*ptr; ptr=str; 执行上面的程序段后,*(ptr+10)的值为( )。
A.'\0'
B.'0'
C.不确定的值
D.'0'的地址
第9题:
设有下列程序段: char str[]="HelloWorld": char* plr; ptr=str: 执行上面的程序段后,*(ptr+10)的值为( )。
A. \0
B.0
C.不确定的值
D.0的地址